Skip to content

Commit

Permalink
separate build and publish into arch-specific jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Jan 30, 2024
1 parent 5bfb05c commit 1650aed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
20 changes: 5 additions & 15 deletions .github/workflows/release-snap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:

jobs:
release-snap:
strategy:
matrix:
arch: [amd64,arm64,s390x]
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -44,6 +47,7 @@ jobs:
- name: make snapcraft
run: |
sed -i 's/{VERSION}/${{ steps.version.outputs.version }}/g' snapcraft.yaml
sed -i 's/{ARCH}/${{ matrix.arch }}/g' snapcraft.yaml
cat snapcraft.yaml
- uses: snapcore/action-build@v1
id: build
Expand All @@ -52,20 +56,6 @@ jobs:
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: 'oras_${{ steps.version.outputs.version }}_amd64.snap'
release: ${{ steps.version.outputs.release }}
- uses: snapcore/action-publish@v1
name: publish arm64
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: 'oras_${{ steps.version.outputs.version }}_arm64.snap'
release: ${{ steps.version.outputs.release }}
- uses: snapcore/action-publish@v1
name: publish s390x
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: 'oras_${{ steps.version.outputs.version }}_s390x.snap'
snap: ${{ steps.build.outputs.snap }}
release: ${{ steps.version.outputs.release }}

14 changes: 3 additions & 11 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ grade: stable

architectures:
- build-on: amd64
build-for: amd64
- build-on: amd64
build-for: arm64
- build-on: amd64
build-for: s390x
build-for: {ARCH}

parts:
oras:
Expand All @@ -35,12 +31,8 @@ parts:
source-type: git
source-tag: $SNAPCRAFT_PROJECT_VERSION
build-environment:
- on amd64 to amd64:
- TARGET_ARCH: "amd64"
- on amd64 to arm64:
- TARGET_ARCH: "arm64"
- on amd64 to s390x:
- TARGET_ARCH: "s390x"
- on amd64 to {ARCH}:
- TARGET_ARCH: "{ARCH}"
build-snaps:
- go/1.21/stable
build-packages:
Expand Down

0 comments on commit 1650aed

Please sign in to comment.