Skip to content

Commit

Permalink
ci: fix output references, move check_relese to build
Browse files Browse the repository at this point in the history
  • Loading branch information
fbozic committed Apr 30, 2024
1 parent eb29899 commit 5d62c78
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
release_exists: ${{ steps.check_release.outputs.exists }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -33,7 +34,6 @@ jobs:
- name: Create artifacts directory
run: |
mkdir -p artifacts
cp README.md artifacts/README.md
cp target/x86_64-unknown-linux-gnu/release/relay-server artifacts/relay-server-x86_64-unknown-linux
cp target/armv7-unknown-linux-gnueabihf/release/relay-server artifacts/relay-server-armv7-unknown-linux
Expand All @@ -47,17 +47,12 @@ jobs:
id: get_version
run: echo "version=$(cargo read-manifest | jq -r '.version')" >> $GITHUB_OUTPUT

release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Check if release exists
id: check_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_URL=$(curl --silent "https://api.github.com/repos/calimero-network/relay-server/releases/tags/${{ needs.build.outputs.version }}" \
RELEASE_URL=$(curl --silent "https://api.github.com/repos/calimero-network/relay-server/releases/tags/${{ steps.get_version.outputs.version }}" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" | jq -r '.url')
if [[ "$RELEASE_URL" != "null" ]]; then
Expand All @@ -66,16 +61,24 @@ jobs:
echo "exists=false" >> $GITHUB_OUTPUT
fi
release:
name: Release
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.release_exists == 'false'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download job artifacts
if: steps.check_release.outputs.exists == 'false'
uses: actions/download-artifact@v4

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: steps.check_release.outputs.exists == 'false'
with:
tag_name: ${{ steps.get_version.outputs.version }}
tag_name: ${{ needs.build.outputs.version }}
files: |
README.md
artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5d62c78

Please sign in to comment.