Skip to content

Commit

Permalink
ci: setup github app token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
fbozic committed Apr 29, 2024
1 parent 94b2e2e commit a353916
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate GitHub token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.ACTIONS_APP_ID }}
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}

- name: Get version
id: get_version
run: echo "version=$(cargo read-manifest | jq -r '.version')" >> $GITHUB_OUTPUT

- name: Check if release exists
id: check_release
env:
GITHUB_OUTPUT: ${{ steps.generate-token.outputs.token }}
run: |
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 }}" \
Expand All @@ -34,11 +43,8 @@ jobs:
if: steps.check_release.outputs.exists == 'false'

- name: Build for Intel Linux
uses: actions-rs/cargo@v1
run: cargo build --release --target=x86_64-unknown-linux-gnu
if: steps.check_release.outputs.exists == 'false'
with:
command: build
args: --release --target=x86_64-unknown-linux-gnu

- name: Build for ARM Linux
run: cross build --release --target=armv7-unknown-linux-gnueabihf
Expand All @@ -53,4 +59,4 @@ jobs:
target/x86_64-unknown-linux-gnu/release/relay-server
target/armv7-unknown-linux-gnueabihf/release/relay-server
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_OUTPUT: ${{ steps.generate-token.outputs.token }}

0 comments on commit a353916

Please sign in to comment.