diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 683d265..970360a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,8 +13,24 @@ on: - latest - v*.*.* jobs: + # Include arm64 if ref is a tag + setup-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Set up matrix + id: set-matrix + run: | + if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then + echo "matrix=[\"ubuntu-latest\", \"arm64\"]" >> $GITHUB_OUTPUT + else + echo "matrix=[\"ubuntu-latest\"]" >> $GITHUB_OUTPUT + fi + tarball: runs-on: ubuntu-latest + needs: [setup-matrix] steps: - uses: pnpm/action-setup@v2 with: @@ -38,8 +54,13 @@ jobs: gp/.build/tarball/*.tar.gz build-deb: - runs-on: ubuntu-latest - needs: [tarball] + needs: + - setup-matrix + - tarball + strategy: + matrix: + os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} + runs-on: ${{ matrix.os }} container: image: yuezk/gpdev:main credentials: @@ -68,14 +89,19 @@ jobs: - name: Upload DEB package uses: actions/upload-artifact@v3 with: - name: artifact-deb + name: artifact-deb-${{ matrix.os }} if-no-files-found: error path: | globalprotect-openconnect-*/.build/deb/*.deb build-rpm: - runs-on: ubuntu-latest - needs: [tarball] + needs: + - setup-matrix + - tarball + strategy: + matrix: + os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} + runs-on: ${{ matrix.os }} container: image: yuezk/gpdev:rpm-builder credentials: @@ -106,14 +132,19 @@ jobs: - name: Upload RPM package uses: actions/upload-artifact@v3 with: - name: artifact-rpm + name: artifact-rpm-${{ matrix.os }} if-no-files-found: error path: | globalprotect-openconnect-*/.build/rpm/*.rpm build-pkgbuild: - runs-on: ubuntu-latest - needs: [tarball] + needs: + - setup-matrix + - tarball + strategy: + matrix: + os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} + runs-on: ${{ matrix.os }} container: image: yuezk/gpdev:pkgbuild credentials: @@ -142,14 +173,19 @@ jobs: - name: Upload PKGBUILD package uses: actions/upload-artifact@v3 with: - name: artifact-pkgbuild + name: artifact-pkgbuild-${{ matrix.os }} if-no-files-found: error path: | globalprotect-openconnect-*/.build/pkgbuild/*.pkg.tar.zst build-binary: - runs-on: ubuntu-latest - needs: [tarball] + needs: + - setup-matrix + - tarball + strategy: + matrix: + os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} + runs-on: ${{ matrix.os }} container: image: yuezk/gpdev:main credentials: @@ -179,13 +215,19 @@ jobs: - name: Upload binary uses: actions/upload-artifact@v3 with: - name: artifact-binary + name: artifact-binary-${{ matrix.os }} if-no-files-found: error path: | globalprotect-openconnect-*/.build/binary/*.bin.tar.xz* build-gpgui: - runs-on: ubuntu-latest + needs: + - setup-matrix + - tarball + strategy: + matrix: + os: ${{fromJson(needs.setup-matrix.outputs.matrix)}} + runs-on: ${{ matrix.os }} container: image: yuezk/gpdev:main credentials: @@ -216,13 +258,13 @@ jobs: - name: Upload gpgui uses: actions/upload-artifact@v3 with: - name: artifact-gpgui + name: artifact-gpgui-${{ matrix.os }} if-no-files-found: error path: | gpgui/.build/package/*.tar.xz* gh-release: - # if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: - build-deb @@ -241,8 +283,7 @@ jobs: uses: softprops/action-gh-release@v1 with: token: ${{ secrets.GH_PAT }} - # prerelease: ${{ contains(github.ref, 'latest') }} - prerelease: true + prerelease: ${{ contains(github.ref, 'latest') }} fail_on_unmatched_files: true files: | artifact/**/*.deb