Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Fix release workflow #16

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,44 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Parse ref
uses: bisgardo/github-action-parse-ref@v1
id: ref
with:
ref: '${{github.ref}}'
- name: Checkout project
uses: actions/checkout@v4
with:
ref: '${{github.ref}}'
ref: '${{steps.ref.outputs.ref}}'
submodules: recursive # necessary to call 'cargo metadata'
- name: Extract version of the crate
uses: bisgardo/github-action-echo@v1
id: crate-version
with:
version: |
$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "concordium-wallet-crypto-uniffi") | .version')
$(cargo metadata --format-version=1 2>/dev/null | jq -r '.packages[] | select(.name == "concordium-wallet-crypto-uniffi") | .version')
- name: 'Print outputs (for debugging)'
run: |
echo "github.ref='${{github.ref}}'"
echo "steps.ref.outputs.ref='${{steps.ref.outputs.ref}}'"
echo "steps.ref.outputs.ref-name='${{steps.ref.outputs.ref-name}}'"
echo "steps.crate-version.outputs.version='${{steps.crate-version.outputs.version}}'"
- name: Fail if tag doesn't match crate version
if: "steps.crate-version.version != github.ref"
if: "steps.crate-version.outputs.version != steps.ref.outputs.ref-name"
run: exit 1
- name: Extract tag message
uses: bisgardo/github-action-echo@v1
id: tag-msg
with:
msg: '$(git for-each-ref "${{github.ref}}" --format="%(contents)")'
msg: '$(git for-each-ref "${{steps.ref.outputs.ref}}" --format="%(contents)")'
- name: Fail if tag is not "annotated" or its message is empty
if: "steps.tag-msg.outputs.msg == ''"
run: exit 1
- name: Upload package as GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: '${{github.ref}}'
name: '${{github.ref}}'
tag_name: '${{steps.ref.outputs.ref-name}}'
name: '${{steps.ref.outputs.ref-name}}'
# Release body is the message of the annotated tag.
body: |
${{steps.tag-msg.outputs.msg}}
Expand Down