-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ChainSafe/nh/ci-publish
Add CI workflow to publish
- Loading branch information
Showing
1 changed file
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,6 @@ jobs: | |
version: 0.13.0 | ||
- name: Install packages | ||
run: sudo apt install libclang-dev llvm | ||
shell: bash | ||
- name: Install cargo toolchains for windows | ||
if: ${{ contains(matrix.targets, 'msvc') }} | ||
uses: taiki-e/install-action@v2 | ||
|
@@ -84,7 +83,6 @@ jobs: | |
tool: cargo-zigbuild | ||
- name: Install rupstup target | ||
run: rustup target add ${{ matrix.targets }} | ||
shell: bash | ||
- run: yarn install | ||
- name: Build | ||
run: yarn build --target ${{ matrix.targets }} --cross-compile | ||
|
@@ -180,4 +178,56 @@ jobs: | |
run: | | ||
set -e | ||
yarn test | ||
publish: | ||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22.4.x' | ||
cache: yarn | ||
- name: Create tag | ||
id: tag | ||
uses: butlerlogic/[email protected] | ||
with: | ||
strategy: package | ||
tag_prefix: "v" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Exit if no version change | ||
if: steps.tag.outputs.tagcreated == 'no' | ||
uses: actions/github-script@v3 | ||
with: | ||
script: core.setFailed('The package.json version did not change. Workflow will not create a release.') | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts | ||
- name: Move artifacts | ||
run: yarn artifacts | ||
- name: List packages | ||
run: ls -R ./npm | ||
- name: Publish | ||
run: | | ||
npm config set provenance true | ||
if node -e "console.log(require('./package.json').version)" | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; | ||
then | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | ||
npm publish --access public | ||
elif node -e "console.log(require('./package.json').version)" | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; | ||
then | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | ||
npm publish --tag next --access public | ||
else | ||
echo "Not a release, skipping publish" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |