Skip to content

Commit

Permalink
Release job fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed Dec 20, 2023
1 parent 490dab0 commit 3b8252d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/release-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,17 @@ 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
- uses: peter-evans/create-pull-request@v5
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
26 changes: 18 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: release

on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
Expand All @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3b8252d

Please sign in to comment.