From 3b8252dc64c2ec2c5df17f2922c5a5abab668cf3 Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Wed, 20 Dec 2023 13:58:11 -0700 Subject: [PATCH] Release job fix --- .github/workflows/release-dispatch.yml | 10 +++------- .github/workflows/release.yml | 26 ++++++++++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-dispatch.yml b/.github/workflows/release-dispatch.yml index cd43bbf812..1306b4c466 100644 --- a/.github/workflows/release-dispatch.yml +++ b/.github/workflows/release-dispatch.yml @@ -19,12 +19,8 @@ jobs: # Workaround described here: https://github.com/actions/checkout/issues/760 - uses: actions/checkout@v3 - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - id: current_release_info - run: | - cargo install cargo-get - echo "version=$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT - run: cargo release version ${{ inputs.version }} --execute --no-confirm && cargo release replace --execute --no-confirm - - id: next_release_info + - id: version_info run: | cargo install cargo-get echo "version=$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT @@ -32,8 +28,8 @@ jobs: with: # We have to use a PAT in order to trigger ci token: ${{ secrets.CREATE_PR_TOKEN }} - title: "Prepare release: v${{ steps.next_release_info.outputs.version }}" - commit-message: "Prepare release: v${{ steps.next_release_info.outputs.version }}" + title: "Prepare release: v${{ steps.version_info.outputs.version }}" + commit-message: "Prepare release: v${{ steps.version_info.outputs.version }}" branch: prepare-release base: main delete-branch: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ddd1751b4..84edcb2558 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: release on: + workflow_dispatch: pull_request: types: [closed] branches: @@ -13,7 +14,7 @@ env: jobs: prepare: - if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'prepare-release' + if: (github.event_name == 'workflow_dispatch') || (github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'prepare-release') runs-on: ubuntu-latest outputs: tag_name: ${{ steps.release_info.outputs.tag_name }} @@ -120,6 +121,7 @@ jobs: # We move binaries so they match $TARGETPLATFORM in the Docker build - name: Move Binaries + if: ${{ env.PLATFORM_NAME == 'linux' }} run: | mkdir -p $PLATFORM_NAME/$ARCH mv target/$TARGET/release/katana $PLATFORM_NAME/$ARCH @@ -128,13 +130,20 @@ jobs: shell: bash # Upload these for use with the Docker build later - - name: Upload binaries + - name: Upload docker binaries uses: actions/upload-artifact@v3 with: name: binaries path: ${{ env.PLATFORM_NAME }} retention-days: 1 + - name: Upload release artifacts + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: ${{ steps.artifacts.outputs.file_name }} + retention-days: 1 + create-draft-release: runs-on: ubuntu-latest-4-cores needs: [prepare, release] @@ -146,11 +155,15 @@ jobs: - uses: actions/checkout@v2 - uses: actions/download-artifact@v3 with: - name: binaries + name: artifacts path: artifacts + - id: version_info + run: | + cargo install cargo-get + echo "version=$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT - name: Display structure of downloaded files run: ls -R artifacts - - run: gh release create --generate-notes --draft ./artifacts + - run: gh release create v${{ steps.version_info.outputs.version }} ./artifacts/*.gz --generate-notes --draft docker-build-and-push: runs-on: ubuntu-latest-4-cores @@ -164,10 +177,7 @@ jobs: uses: actions/download-artifact@v3 with: name: binaries - path: artifacts - - - name: Display structure of downloaded files - run: ls -R artifacts + path: artifacts/linux - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1