diff --git a/.github/workflows/publish-bolt-crates.yml b/.github/workflows/publish-bolt-crates.yml index 17c4f1a..2e15ccc 100644 --- a/.github/workflows/publish-bolt-crates.yml +++ b/.github/workflows/publish-bolt-crates.yml @@ -1,7 +1,10 @@ name: Publish Bolt crates on: release: - types: [published] + types: [ published ] + push: + branches: + - 'release/v*' workflow_dispatch: env: @@ -106,6 +109,10 @@ jobs: - 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: Use Node ${{ matrix.node }} uses: actions/setup-node@v4 with: @@ -151,7 +158,8 @@ jobs: - name: Check versions are aligned run: | # Fails if versions are not aligned - ./scripts/version-align.sh --check + cargo install git-cliff + ./version-align.sh --check - name: run build run: | @@ -173,16 +181,22 @@ jobs: - name: cargo publish run: | - cargo publish --manifest-path=crates/bolt-lang/attribute/account/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/attribute/component/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/attribute/component-deserialize/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/attribute/component-id/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/attribute/system/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/attribute/system-input/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/attribute/bolt-program/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=programs/bolt-system/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=programs/bolt-component/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=programs/world/Cargo.toml --token ${CRATES_TOKEN} - cargo publish --manifest-path=crates/bolt-lang/Cargo.toml --token ${CRATES_TOKEN} + DRY_RUN_FLAG="" + if [ "${DRY_RUN}" = "true" ]; then + DRY_RUN_FLAG="--dry-run" + fi + + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/account/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/component/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/component-deserialize/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/component-id/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/system/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/system-input/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/attribute/bolt-program/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=programs/bolt-system/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=programs/bolt-component/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=programs/world/Cargo.toml --token ${CRATES_TOKEN} + cargo publish $DRY_RUN_FLAG --manifest-path=crates/bolt-lang/Cargo.toml --token ${CRATES_TOKEN} env: CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} + DRY_RUN: ${{ env.DRY_RUN }} diff --git a/.github/workflows/publish-bolt-sdk.yml b/.github/workflows/publish-bolt-sdk.yml index 077e26f..0673d66 100644 --- a/.github/workflows/publish-bolt-sdk.yml +++ b/.github/workflows/publish-bolt-sdk.yml @@ -1,7 +1,10 @@ name: Publish Bolt SDKs on: release: - types: [published] + types: [ published ] + push: + branches: + - 'release/v*' workflow_dispatch: env: @@ -106,6 +109,10 @@ jobs: - 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: Use Node ${{ matrix.node }} uses: actions/setup-node@v4 with: @@ -151,7 +158,8 @@ jobs: - name: Check versions are aligned run: | # Fails if versions are not aligned - ./scripts/version-align.sh --check + cargo install git-cliff + ./version-align.sh --check - name: run build run: | @@ -176,6 +184,12 @@ jobs: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} cd clients/bolt-sdk/ && yarn build && yarn lint:fix && cd ../../ && yarn lint:fix - cd clients/bolt-sdk/ && npm publish + cd clients/bolt-sdk/ + 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: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml index 1ac98bc..29c07fd 100644 --- a/.github/workflows/publish-packages.yml +++ b/.github/workflows/publish-packages.yml @@ -147,7 +147,7 @@ jobs: cp "target/${{ matrix.build.TARGET }}/release/${bin}" "${node_pkg}/bin" # 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 release_name="${release_name}.exe" fi @@ -155,6 +155,7 @@ jobs: mv "target/${{ matrix.build.TARGET }}/release/${bin}" "target/${{ matrix.build.TARGET }}/release/${release_name}" - name: Publish binary to GitHub release + if: env.DRY_RUN != 'true' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }}