Merge pull request #1162 from cloudflare/smelly #2903
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: Compile | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
show-progress: false | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version-file: go.ver | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Docker Login | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test releasing binaries | |
if: github.event_name == 'pull_request' | |
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 | |
with: | |
args: release --clean --skip=validate --skip=sign --skip=sbom --skip=publish --snapshot | |
- name: Extract release changelog | |
if: startsWith(github.ref, 'refs/tags/') | |
id: changelog | |
uses: sean0x42/markdown-extract@4178293dd16a52514b6cb2c01f4d309d264b2736 # v2 | |
with: | |
file: docs/changelog.md | |
pattern: "${{ github.ref_name }}" | |
no-print-matched-heading: true | |
- name: Write changelog | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
mkdir .tmp | |
exec 3<<'HERE' | |
${{ steps.changelog.outputs.markdown }} | |
HERE | |
cat /dev/fd/3 | tee .tmp/changelog.txt | |
- name: Release binaries | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 | |
with: | |
args: release --clean --release-notes=.tmp/changelog.txt | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |