Skip to content

Run AUR publish automatically on release #14

Run AUR publish automatically on release

Run AUR publish automatically on release #14

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*.rc.*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Build release artifact
env:
CGO_ENABLED: '0'
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
asset="dloom_${VERSION}_${GOOS}_${GOARCH}.tar.gz"
staging_dir="build/${GOOS}_${GOARCH}"
mkdir -p "${staging_dir}"
go build -trimpath \
-ldflags "-s -w -X github.com/dloomorg/dloom/cmd.Version=${VERSION}" \
-o "${staging_dir}/dloom" .
tar -C "${staging_dir}" -czf "build/${asset}" dloom
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
path: build/dloom_${{ env.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
path: build
- name: Generate checksums
run: |
cd build
for file in $(printf '%s\n' *.tar.gz | sort); do
sha256sum "$file"
done > SHA256SUMS.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
build/*.tar.gz
build/SHA256SUMS.txt
prerelease: ${{ contains(github.ref_name, '.rc.') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_aur:
name: Publish AUR
needs: release
if: ${{ !contains(github.ref_name, '.rc.') }}
uses: ./.github/workflows/publish-aur.yml
with:
version: ${{ github.ref_name }}
secrets: inherit
publish_aur_bin:
name: Publish AUR Bin
needs: release
if: ${{ !contains(github.ref_name, '.rc.') }}
uses: ./.github/workflows/publish-aur-bin.yml
with:
version: ${{ github.ref_name }}
secrets: inherit