|
@@ -2,6 +2,9 @@ name: Publish bolt-cli packages
|
|
on:
|
|
on:
|
|
release:
|
|
release:
|
|
types: [ published ]
|
|
types: [ published ]
|
|
|
|
+ push:
|
|
|
|
+ branches:
|
|
|
|
+ - 'release/v*'
|
|
workflow_dispatch:
|
|
workflow_dispatch:
|
|
inputs:
|
|
inputs:
|
|
release_version:
|
|
release_version:
|
|
@@ -63,9 +66,23 @@ jobs:
|
|
- name: Checkout
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
+ - name: Set DRY_RUN based on trigger
|
|
|
|
+ shell: bash
|
|
|
|
+ run: echo "DRY_RUN=true" >> $GITHUB_ENV
|
|
|
|
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v')
|
|
|
|
+
|
|
- name: Set the release version
|
|
- name: Set the release version
|
|
shell: bash
|
|
shell: bash
|
|
- run: echo "RELEASE_VERSION=${github.event.inputs.release_version || GITHUB_REF:11}" >> $GITHUB_ENV
|
|
|
|
|
|
+ run: |
|
|
|
|
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
|
|
+ echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV
|
|
|
|
+ elif [[ "${{ github.event_name }}" == "push" ]]; then
|
|
|
|
+ VERSION=$(echo "${GITHUB_REF}" | sed -E 's|refs/heads/release/v||')
|
|
|
|
+ echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
|
|
|
|
+ elif [[ "${{ github.event_name }}" == "release" ]]; then
|
|
|
|
+ VERSION=$(echo "${GITHUB_REF}" | sed -E 's|refs/tags/v||')
|
|
|
|
+ echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
|
|
|
|
+ fi
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
- name: Install Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
uses: actions-rs/toolchain@v1
|
|
@@ -92,7 +109,8 @@ jobs:
|
|
- name: Check versions are aligned
|
|
- name: Check versions are aligned
|
|
run: |
|
|
run: |
|
|
# Fails if versions are not aligned
|
|
# Fails if versions are not aligned
|
|
- ./scripts/version-align.sh --check
|
|
|
|
|
|
+ cargo install git-cliff
|
|
|
|
+ ./version-align.sh --check
|
|
|
|
|
|
- name: Build the NPM package
|
|
- name: Build the NPM package
|
|
shell: bash
|
|
shell: bash
|
|
@@ -130,7 +148,7 @@ jobs:
|
|
cp "target/${{ matrix.build.TARGET }}/release/${bin}" "${node_pkg}/bin"
|
|
cp "target/${{ matrix.build.TARGET }}/release/${bin}" "${node_pkg}/bin"
|
|
|
|
|
|
# Create the release bin file
|
|
# Create the release bin file
|
|
- release_name="bolt-${{ matrix.build.NAME }}"
|
|
|
|
|
|
+ release_name="bolt-cli-${{ matrix.build.NAME }}"
|
|
if [ "${{ matrix.build.OS }}" = "windows-2022" ]; then
|
|
if [ "${{ matrix.build.OS }}" = "windows-2022" ]; then
|
|
release_name="${release_name}.exe"
|
|
release_name="${release_name}.exe"
|
|
fi
|
|
fi
|
|
@@ -138,6 +156,7 @@ jobs:
|
|
mv "target/${{ matrix.build.TARGET }}/release/${bin}" "target/${{ matrix.build.TARGET }}/release/${release_name}"
|
|
mv "target/${{ matrix.build.TARGET }}/release/${bin}" "target/${{ matrix.build.TARGET }}/release/${release_name}"
|
|
|
|
|
|
- name: Publish binary to GitHub release
|
|
- name: Publish binary to GitHub release
|
|
|
|
+ if: ${{ env.DRY_RUN != 'true' }}
|
|
uses: svenstaro/upload-release-action@v2
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -148,12 +167,18 @@ jobs:
|
|
asset_name: "${{ env.release_name }}"
|
|
asset_name: "${{ env.release_name }}"
|
|
|
|
|
|
- name: Publish the NPM package
|
|
- name: Publish the NPM package
|
|
- shell: bash
|
|
|
|
run: |
|
|
run: |
|
|
|
|
+ echo "DRY_RUN=${{ env.DRY_RUN }}"
|
|
cd ${{ env.node_pkg }}
|
|
cd ${{ env.node_pkg }}
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
- npm publish --access public
|
|
|
|
|
|
+ if [ "${{ env.DRY_RUN }}" = "true" ]; then
|
|
|
|
+ echo "Running npm publish in dry-run mode"
|
|
|
|
+ npm publish --access public --dry-run
|
|
|
|
+ else
|
|
|
|
+ npm publish --access public
|
|
|
|
+ fi
|
|
|
|
+ shell: bash
|
|
env:
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
publish-wrapper-npm-package:
|
|
publish-wrapper-npm-package:
|
|
@@ -163,6 +188,9 @@ jobs:
|
|
steps:
|
|
steps:
|
|
- name: Checkout
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
uses: actions/checkout@v4
|
|
|
|
+ - name: Set DRY_RUN based on trigger
|
|
|
|
+ run: echo "DRY_RUN=true" >> $GITHUB_ENV
|
|
|
|
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v')
|
|
- name: Publish the NPM package
|
|
- name: Publish the NPM package
|
|
shell: bash
|
|
shell: bash
|
|
run: |
|
|
run: |
|
|
@@ -172,6 +200,11 @@ jobs:
|
|
cd lib
|
|
cd lib
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
- npm publish --access public
|
|
|
|
|
|
+ if [ "${DRY_RUN}" = "true" ]; then
|
|
|
|
+ echo "Running npm publish in dry-run mode"
|
|
|
|
+ npm publish --access public --dry-run
|
|
|
|
+ else
|
|
|
|
+ npm publish --access public
|
|
|
|
+ fi
|
|
env:
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|