From d44641603a07806d6297dc78dde24400edba973a Mon Sep 17 00:00:00 2001 From: Michael Bisgaard Olesen Date: Thu, 25 Apr 2024 15:33:01 +0200 Subject: [PATCH 1/5] CI: Fix package release workflow --- .github/workflows/publish-release.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3e26567..25d99bf 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -10,32 +10,43 @@ 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}}' - 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') + - name: 'Debug outputs' + run: | + echo ${{github.ref}} + echo ${{steps.ref.outputs.ref}} + echo ${{steps.ref.outputs.ref-name}} + echo ${{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}} From 03780d6bdf495ece9cb482be81fb7f0d0d537719 Mon Sep 17 00:00:00 2001 From: Michael Bisgaard Olesen Date: Thu, 25 Apr 2024 15:35:11 +0200 Subject: [PATCH 2/5] Fix --- .github/workflows/publish-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 25d99bf..5bca498 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -27,10 +27,10 @@ jobs: $(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "concordium-wallet-crypto-uniffi") | .version') - name: 'Debug outputs' run: | - echo ${{github.ref}} - echo ${{steps.ref.outputs.ref}} - echo ${{steps.ref.outputs.ref-name}} - echo ${{steps.crate-version.outputs.version}} + echo "${{github.ref}}" + echo "${{steps.ref.outputs.ref}}" + echo "${{steps.ref.outputs.ref-name}}" + echo "${{steps.crate-version.outputs.version}}" - name: Fail if tag doesn't match crate version if: "steps.crate-version.outputs.version != steps.ref.outputs.ref-name" run: exit 1 From f36825d7ee63d2dbc8509a110f4b0ee8221f928f Mon Sep 17 00:00:00 2001 From: Michael Bisgaard Olesen Date: Thu, 25 Apr 2024 15:37:52 +0200 Subject: [PATCH 3/5] Fix --- .github/workflows/publish-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 5bca498..0e04499 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@v4 with: 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 From 7e86788b7a2d61a01866bb93d3d61e32eb908947 Mon Sep 17 00:00:00 2001 From: Michael Bisgaard Olesen Date: Thu, 25 Apr 2024 15:39:52 +0200 Subject: [PATCH 4/5] Ignore stderr of cargo metadata --- .github/workflows/publish-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 0e04499..6602d59 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -25,7 +25,7 @@ jobs: 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: 'Debug outputs' run: | echo "${{github.ref}}" From 965b17aff08388c4735584f60adc7aaf51f02669 Mon Sep 17 00:00:00 2001 From: Michael Bisgaard Olesen Date: Thu, 25 Apr 2024 15:42:35 +0200 Subject: [PATCH 5/5] Cleanup --- .github/workflows/publish-release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6602d59..7a80e7a 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -26,12 +26,12 @@ jobs: with: version: | $(cargo metadata --format-version=1 2>/dev/null | jq -r '.packages[] | select(.name == "concordium-wallet-crypto-uniffi") | .version') - - name: 'Debug outputs' + - name: 'Print outputs (for debugging)' run: | - echo "${{github.ref}}" - echo "${{steps.ref.outputs.ref}}" - echo "${{steps.ref.outputs.ref-name}}" - echo "${{steps.crate-version.outputs.version}}" + 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.outputs.version != steps.ref.outputs.ref-name" run: exit 1