Files
muun-recovery/.github/workflows/pr.yml
2025-05-13 17:49:44 -03:00

136 lines
3.6 KiB
YAML

name: Build and release
on:
push:
branches: release-v*
tags: v*
jobs:
build-mac:
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, macos-15]
arch: [amd64, arm64]
runs-on: ${{ matrix.os }}
env:
out: recovery-tool-${{ matrix.os }}-${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Create output dir
run: |
mkdir -p bin
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
with:
go-version: '1.22.6'
- name: Build
run: |
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=${{ matrix.arch }} \
go build -mod=vendor -a -trimpath -o bin/${{ env.out }} ./recovery_tool
- name: Upload binary
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: ${{ env.out }}
path: bin/${{ env.out }}
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target:
- os: "linux"
arch: "386"
out: "recovery-tool-linux32"
cc: "i686-linux-gnu-gcc-12"
- os: "linux"
arch: "amd64"
out: "recovery-tool-linux64"
cc: "x86_64-linux-gnu-gcc-12"
- os: "linux"
arch: "arm64"
out: "recovery-tool-linuxaarch64"
cc: "aarch64-linux-gnu-gcc-12"
- os: "windows"
arch: "386"
cc: "i686-w64-mingw32-gcc"
out: "recovery-tool-windows32.exe"
- os: "windows"
arch: "amd64"
cc: "x86_64-w64-mingw32-gcc"
out: "recovery-tool-windows64.exe"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
with:
buildkitd-flags: --debug
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Create output dir
run: |
mkdir -p bin
- name: Build
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
with:
file: recovery_tool/Dockerfile
context: .
outputs: bin
cache-from: type=gha
cache-to: type=gha,mode=min
build-args: |
cc=${{ matrix.target.cc }}
os=${{ matrix.target.os }}
arch=${{ matrix.target.arch }}
out=${{ matrix.target.out }}
- name: Upload binary
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: ${{ matrix.target.out }}
path: bin/${{ matrix.target.out }}
release:
runs-on: ubuntu-24.04
needs: [build-mac, build]
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
if: startsWith(github.ref, 'refs/tags/')
with:
path: artifacts
pattern: recovery-tool-*
- name: Compute SHA256 checksums
run: |
echo "| System | Checksum |" > sha_sum_table
echo "| --- | --- |" >> sha_sum_table
sha256sum artifacts/*/* | sed "s/\([^ ]*\) *artifacts\/[^/]*\/\(.*\)/| \2 | \1 |/" >> sha_sum_table
- name: Release
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: sha_sum_table
files: |
artifacts/*/*