ci: trigger go build on various arch for test-release branches #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- test-release* | |
tags: | |
- v[0-9].[0-9]+.[0-9]+ | |
jobs: | |
create_release: | |
name: create_release | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check version matches | |
run: | | |
[[ "$(grep app.Version main.go | sed -r 's/.*\"(v[0-9\.]+)\"/\1/')" =~ "${{ github.ref_name }}" ]] | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
prerelease: false | |
build: | |
name: build-rz-pm | |
runs-on: ubuntu-22.04 | |
needs: create_release | |
strategy: | |
matrix: | |
goos: [windows, darwin, freebsd, openbsd, netbsd, linux, android] | |
goarch: [amd64, arm64] | |
include: | |
- goarch: amd64 | |
asset_arch: x86_64 | |
- goarch: arm64 | |
asset_arch: arm64 | |
- goos: linux | |
goarch: arm | |
asset_arch: arm7 | |
goarm: 7 | |
- goos: linux | |
goarch: ppc64le | |
asset_arch: ppc64le | |
- goos: linux | |
goarch: s390x | |
asset_arch: s390x | |
- goos: android | |
goarch: arm64 | |
asset_arch: arm64 | |
- goos: android | |
goarch: arm | |
asset_arch: arm | |
goarm: 7 | |
cgo_enabled: 1 | |
cc: /tmp/android-ndk/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.19 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v1 | |
- name: Install Android NDK | |
if: matrix.goos == 'android' | |
run: | | |
curl -L https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip -o android-ndk.zip | |
unzip android-ndk.zip -d /tmp/android-ndk | |
- name: Build the Go binary | |
run: go build | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GOARM: ${{ matrix.goarm }} | |
CGO_ENABLED: ${{ matrix.cgo_enabled }} | |
CC: ${{ matrix.cc }} | |
- name: Upload artifact | |
if: matrix.goos != 'windows' && startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./rz-pm | |
asset_name: rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }} | |
asset_content_type: application/octet-stream | |
- name: Upload artifact (windows) | |
if: matrix.goos == 'windows' && startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./rz-pm.exe | |
asset_name: rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}.exe | |
asset_content_type: application/octet-stream |