oxc/.github/workflows/release_napi.yml
dependabot[bot] aa1277caed
chore(deps): bump EndBug/version-check from 1 to 2 (#825)
Bumps [EndBug/version-check](https://github.com/endbug/version-check)
from 1 to 2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/endbug/version-check/releases">EndBug/version-check's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0</h2>
<p>From now on, the <code>changed</code> output will always be either
<code>'true'</code> or <code>'false'</code>, and never
<code>undefined</code>.</p>
<h2>v1.6.0</h2>
<p>You can now use the <code>::before</code> tag in private repos (PR <a
href="https://redirect.github.com/endbug/version-check/issues/27">#27</a>)</p>
<h2>v1.5.0</h2>
<p>You can now use <code>::before</code> as the <code>file-url</code>
parameter: it will resolve to the file from the commit before the push
event that triggered the workflow run.
Also, this repo now follows the All Contributors specifications </p>
<h2>v1.4.0</h2>
<p>This version adds three new options: <code>file-url</code>,
<code>assume-same-version</code> and <code>static-checking</code>.
Please see the README to find out how to use them.
As always, if you find any bugs please let me know by opening a new
issue in this repo.</p>
<h2>v1.3.0</h2>
<p>This version adds two features:</p>
<ul>
<li>The action can now be used with PRs</li>
<li>The action now has a <code>commit</code> output, from which you can
grab the sha of the commit where the version change has been
detected</li>
</ul>
<h2>v1.2.2</h2>
<p>This makes the action automatically build with
<code>@zeit/ncc</code>. No significant changes should be noticed by the
end user, if not a slight improvement in performance.</p>
<h2>v1.2.1</h2>
<p>This patch fixes issue <a
href="https://redirect.github.com/endbug/version-check/issues/11">#11</a>:
the action wasn't detecting versions with a more complex format, like
<code>1.2.3-alpha.10.beta.0+build.unicorn.rainbow</code>, because it was
stopping at the patch number (<code>1.2.3</code>). This should now be
fixed</p>
<h2>v1.2.0</h2>
<p>This release adds the <code>version</code> output: it's a string with
the new version, and can be used to, for example, create a new release
with the version name.</p>
<h2>v1.1.1</h2>
<p>This release is just to add the major version tag <code>v1</code>,
which can be used to keep the action updated while avoiding breaking
changes.</p>
<h2>v1.1.0</h2>
<p>This version adds support for private repositories, you just need to
pass the bearer GitHub token as an input. You can find more info about
that on the action page.</p>
<h2>v1.0.1</h2>
<p>This adds a useful example if you want to use this action to publish
your package to both NPM and GitHub Package Registry.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="323ba664f1"><code>323ba66</code></a>
2.1.1</li>
<li><a
href="6d2f38ddd5"><code>6d2f38d</code></a>
docs: add Gerrit0 as a contributor for code (<a
href="https://redirect.github.com/endbug/version-check/issues/185">#185</a>)</li>
<li><a
href="82e9bfe44e"><code>82e9bfe</code></a>
Update to Node 16 (<a
href="https://redirect.github.com/endbug/version-check/issues/184">#184</a>)</li>
<li><a
href="d2a27886f3"><code>d2a2788</code></a>
chore(deps-dev): bump all-contributors-cli from 6.22.0 to 6.23.1 (<a
href="https://redirect.github.com/endbug/version-check/issues/183">#183</a>)</li>
<li><a
href="dc6b9cdf68"><code>dc6b9cd</code></a>
[auto] build: update compiled version</li>
<li><a
href="9dda8f6b23"><code>9dda8f6</code></a>
chore(deps-dev): bump all-contributors-cli from 6.20.5 to 6.22.0 (<a
href="https://redirect.github.com/endbug/version-check/issues/182">#182</a>)</li>
<li><a
href="1da399082b"><code>1da3990</code></a>
chore(deps): bump <code>@​actions/core</code> from 1.9.1 to 1.10.0 (<a
href="https://redirect.github.com/endbug/version-check/issues/181">#181</a>)</li>
<li><a
href="254e871301"><code>254e871</code></a>
chore(deps-dev): bump typescript from 4.8.3 to 4.8.4 (<a
href="https://redirect.github.com/endbug/version-check/issues/180">#180</a>)</li>
<li><a
href="e3c71fe61d"><code>e3c71fe</code></a>
chore(deps-dev): bump all-contributors-cli from 6.20.4 to 6.20.5 (<a
href="https://redirect.github.com/endbug/version-check/issues/179">#179</a>)</li>
<li><a
href="e285746efc"><code>e285746</code></a>
chore(deps-dev): bump all-contributors-cli from 6.20.0 to 6.20.4 (<a
href="https://redirect.github.com/endbug/version-check/issues/178">#178</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/endbug/version-check/compare/v1...v2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=EndBug/version-check&package-manager=github_actions&previous-version=1&new-version=2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-01 11:39:38 +08:00

180 lines
5.2 KiB
YAML

name: Release NAPI
# When main is pushed and npm/napi/package.json has been changed,
# trigger the jobs after the ci workflow has been passed.
on:
push:
branches:
- main
paths:
- npm/napi/package.json # Please only commit this file, so we don't need to wait for test CI to pass.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check version
runs-on: ubuntu-latest
outputs:
version: ${{ env.version }}
version_changed: ${{ steps.version.outputs.changed }}
steps:
- uses: actions/checkout@v3
- name: Check version changes
uses: EndBug/version-check@v2
id: version
with:
static-checking: localIsNew
file-url: https://unpkg.com/@oxidation-compiler/napi@latest/package.json
file-name: npm/napi/package.json
- name: Set version name
if: steps.version.outputs.changed == 'true'
run: |
echo "Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})"
echo "version=${{ steps.version.outputs.version }}" >> $GITHUB_ENV
build:
needs: check
if: needs.check.outputs.version_changed == 'true'
env:
version: ${{ needs.check.outputs.version }}
outputs:
version: ${{ env.version }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64-msvc
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target: linux-x64-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
code-target: linux-arm64-gnu
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
name: Package ${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install cross
uses: taiki-e/install-action@cross
- name: Add Rust Target
run: rustup target add ${{ matrix.target }}
- name: Build with cross
run: cross build -p oxc_napi --release --target=${{ matrix.target }}
- name: Move file on ${{ matrix.os }}
shell: bash
run: |
shopt -s extglob
ls target/${{ matrix.target }}/release/*.@(so|dll|dylib)
mv target/${{ matrix.target }}/release/*.@(so|dll|dylib) crates/oxc_napi/napi.${{ matrix.code-target }}.node
ls crates/oxc_napi
- name: Test
working-directory: crates/oxc_napi
if: ${{ contains(matrix.target, 'x86') }} # Need docker for aarch64
run: |
ls
node test.mjs
# The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss
- name: Archive Binary
if: runner.os == 'Windows'
shell: bash
run: 7z a ${{ matrix.code-target }}.zip crates/oxc_napi/napi.${{ matrix.code-target }}.node
# The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss
- name: Archive Binary
if: runner.os != 'Windows'
shell: bash
run: tar czf ${{ matrix.code-target }}.tar.gz crates/oxc_napi/napi.${{ matrix.code-target }}.node
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: binaries
path: |
*.zip
*.tar.gz
publish:
name: Publish NAPI
runs-on: ubuntu-latest
permissions:
contents: write # for softprops/action-gh-release@v1
id-token: write # for `npm publish --provenance`
needs:
- build
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: binaries
- name: Unzip
uses: montudor/action-zip@v1
with:
args: unzip -qq *.zip -d .
- name: Untar
shell: bash
run: ls *.gz | xargs -i tar xvf {}
- name: Generate npm packages
shell: bash
run: |
ls
ls crates/oxc_napi
node npm/napi/scripts/generate-packages.mjs
cat npm/napi/package.json
for package in npm/napi*
do
ls $package
cat $package/package.json
echo '----'
done
- name: Publish npm packages as latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# NOTE: The trailing slash on $package/ changes it to publishing the directory
shell: bash
run: |
for package in npm/napi*
do
npm publish $package/ --tag latest --provenance --access public
echo '----'
done