Skip to content

Commit

Permalink
ci: Update release procedure
Browse files Browse the repository at this point in the history
Replace some outdated GitHub Actions with the `gh` command.
  • Loading branch information
apyrgio committed Nov 2, 2024
1 parent ad8647a commit 2972575
Showing 1 changed file with 28 additions and 42 deletions.
70 changes: 28 additions & 42 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,43 +127,34 @@ jobs:
needs: ["basic_checks", "test", "build", "lint_proto"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set release tag
run: echo GITHUB_RELEASE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ env.GITHUB_RELEASE_TAG }}
draft: true
prerelease: false
body: |
This release contains the latest assets for tag `${{ env.GITHUB_RELEASE_TAG }}`.
- name: Create release notes
run: |
cat > release_notes <<EOF
This release contains the latest assets for tag `${{ env.GITHUB_RELEASE_TAG }}`.
## Changes
## Changes
The changes for this release can be found in the [changelog].
The changes for this release can be found in the [changelog].
[changelog]: https://github.com/${{ github.repository }}/blob/${{ env.GITHUB_RELEASE_TAG }}/CHANGELOG.md
[changelog]: https://github.com/${{ github.repository }}/blob/${{ env.GITHUB_RELEASE_TAG }}/CHANGELOG.md
EOF
- name: Store release context
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat <<EOF > release_context
::set-output name=ref::${{ env.GITHUB_RELEASE_TAG }}
::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}
EOF
- name: Upload release context
uses: actions/upload-artifact@v4
with:
name: release_context
path: release_context
gh release create ${{ env.GITHUB_RELEASE_TAG }} \
--title "Release ${{ env.GITHUB_RELEASE_TAG }}" \
--draft --notes-file release_notes
upload_assets:
name: Upload release assets (${{ matrix.arch }})
name: Upload release assets ( ${{ matrix.arch }} )
needs: create_release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
Expand All @@ -178,28 +169,23 @@ jobs:
extension: .exe

steps:
- name: Download release context
uses: actions/download-artifact@v4
with:
name: release_context
path: ctx
- name: Checkout
uses: actions/checkout@v4

- name: Restore release context
id: release_ctx
run: cat ctx/release_context
- name: Set release tag
run: echo GITHUB_RELEASE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV

- name: Download binary
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: ${{ env.BINARY_NAME }}_${{ matrix.arch }}${{ matrix.extension}}
path: assets_${{ matrix.arch }}

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_ctx.outputs.upload_url }}
asset_path: assets_${{ matrix.arch }}/${{ env.BINARY_NAME }}${{ matrix.extension }}
asset_name: ${{ env.BINARY_NAME }}_${{ steps.release_ctx.outputs.ref }}_${{ matrix.arch }}${{ matrix.extension}}
asset_content_type: application/octet-stream
run: |
cd assets_${{ matrix.arch }}
TAGGED_ASSET_NAME=${{ env.BINARY_NAME }}_${{ env.GITHUB_RELEASE_TAG }}_${{ matrix.arch }}${{ matrix.extension}}
mv ${{ env.BINARY_NAME }}${{ matrix.extension }} ${TAGGED_ASSET_NAME}
gh release upload ${{ env.GITHUB_RELEASE_TAG }} ${TAGGED_ASSET_NAME}

0 comments on commit 2972575

Please sign in to comment.