| 1 |
name: release |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
tags: |
| 7 |
- 'v*' |
| 8 |
workflow_dispatch: |
| 9 |
inputs: |
| 10 |
refToBuild: |
| 11 |
description: 'Branch, tag or commit SHA1 to build' |
| 12 |
required: false |
| 13 |
type: string |
| 14 |
|
| 15 |
jobs: |
| 16 |
release: |
| 17 |
permissions: |
| 18 |
contents: write |
| 19 |
strategy: |
| 20 |
matrix: |
| 21 |
# We can cross-compile from Linux to macOS and Windows. See .goreleaser.yaml |
| 22 |
# So running just on ubuntu is sufficient. |
| 23 |
go-version: [1.21.x] |
| 24 |
os: [ubuntu-latest] |
| 25 |
|
| 26 |
name: Release (${{ matrix.os}}, Go ${{ matrix.go-version }}) |
| 27 |
runs-on: ${{ matrix.os }} |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@v4 |
| 30 |
with: |
| 31 |
fetch-depth: 0 |
| 32 |
ref: ${{ inputs.refToBuild }} |
| 33 |
submodules: recursive |
| 34 |
- uses: actions/setup-go@v5 |
| 35 |
with: |
| 36 |
go-version: ${{ matrix.go-version }} |
| 37 |
cache: true |
| 38 |
- shell: bash |
| 39 |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV |
| 40 |
- id: cache |
| 41 |
uses: actions/cache@v3 |
| 42 |
with: |
| 43 |
path: dist/${{ matrix.os }} |
| 44 |
key: ${{ matrix.go }}-${{ env.sha_short }} |
| 45 |
- name: Install Linux packages |
| 46 |
run: sudo apt-get update && sudo apt-get -y install libssl-dev cmake clang pkg-config |
| 47 |
if: runner.os == 'Linux' |
| 48 |
- name: Setup Rust |
| 49 |
uses: dtolnay/rust-toolchain@stable |
| 50 |
- name: Install bindgen-cli |
| 51 |
run: cargo install bindgen-cli |
| 52 |
if: runner.os == 'Linux' |
| 53 |
- name: Build KeyManager Rust library |
| 54 |
run: | |
| 55 |
cd keymanager |
| 56 |
cargo build --release |
| 57 |
if: runner.os == 'Linux' |
| 58 |
- name: Build all modules |
| 59 |
run: go build -v ./... ./cmd/... ./launcher/... ./verifier/... |
| 60 |
- name: Run GoReleaser |
| 61 |
uses: goreleaser/goreleaser-action@v6 |
| 62 |
if: success() && (startsWith(github.ref, 'refs/tags/') || startsWith(inputs.refToBuild, 'refs/tags/')) && steps.cache.outputs.cache-hit != 'true' |
| 63 |
with: |
| 64 |
version: latest |
| 65 |
args: release --clean |
| 66 |
env: |
| 67 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |