Skip to content

Release as a prerelease (#31) #89

Release as a prerelease (#31)

Release as a prerelease (#31) #89

Workflow file for this run

---
name: Go
on: # yamllint disable-line rule:truthy
push:
branches: [main]
tags:
- '*'
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
- .github/dependabot.yml
workflow_dispatch:
concurrency:
group: >-
${{ github.workflow }} @
${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
release:
needs: build
# Only run release job on tags
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Build release - Linux amd64
env:
GOOS: linux
GOARCH: amd64
run: go build -o ${{ github.event.repository.name }}-linux-amd64 ./...
- name: Build release - Linux arm64
env:
GOOS: linux
GOARCH: arm64
run: go build -o ${{ github.event.repository.name }}-linux-arm64 ./...
- name: Build release - macOS arm64
env:
GOOS: darwin
GOARCH: arm64
run: go build -o ${{ github.event.repository.name }}-darwin-arm64 ./...
- name: Build release - Windows amd64
env:
GOOS: windows
GOARCH: amd64
run: >-
go build -o
${{ github.event.repository.name }}-windows-amd64.exe ./...
- name: Package personalities directory
run: tar czf personalities.tar.gz personalities/
- name: Upload personalities tarball
uses: actions/upload-artifact@v4
with:
name: personalities.tar.gz
path: personalities.tar.gz
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: |
${{ github.event.repository.name }}-linux-amd64
${{ github.event.repository.name }}-linux-arm64
${{ github.event.repository.name }}-darwin-arm64
${{ github.event.repository.name }}-windows-amd64.exe
- name: Attestations
uses: actions/attest@v1
with:
predicate-type: 'https://in-toto.io/attestation/release/v0.1'
predicate:
'{"purl":"pkg:github/${{ github.repository }}@${{ github.sha }}"}'
subject-path: |
personalities.tar.gz
${{ github.event.repository.name }}-linux-amd64
${{ github.event.repository.name }}-linux-arm64
${{ github.event.repository.name }}-darwin-arm64
${{ github.event.repository.name }}-windows-amd64.exe
- name: Create Release
id: create_release
run: >-
gh release create ${{ github.ref_name }}
--title ${{ github.event.repository.name }}-${{ github.ref_name }}
--generate-notes
--prerelease
${{ github.event.repository.name }}-*
personalities.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}