Skip to content

docs: add action input to readme #12

docs: add action input to readme

docs: add action input to readme #12

Workflow file for this run

name: Release Binaries
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
goos: linux
goarch: amd64
- os: linux
arch: arm64
goos: linux
goarch: arm64
- os: darwin
arch: amd64
goos: darwin
goarch: amd64
- os: darwin
arch: arm64
goos: darwin
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
go build -v -ldflags="-X main.version=${VERSION}" -o copepod-${{ matrix.os }}-${{ matrix.arch }}
chmod +x copepod-${{ matrix.os }}-${{ matrix.arch }}
- name: Generate SHA-256
run: |
sha256sum copepod-${{ matrix.os }}-${{ matrix.arch }} > copepod-${{ matrix.os }}-${{ matrix.arch }}.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}-${{ matrix.arch }}
path: |
copepod-${{ matrix.os }}-${{ matrix.arch }}
copepod-${{ matrix.os }}-${{ matrix.arch }}.sha256
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
merge-multiple: true
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
# Create release notes
echo "Release $VERSION" > release_notes.md
echo "" >> release_notes.md
echo "## SHA-256 Checksums" >> release_notes.md
echo '```' >> release_notes.md
cat *.sha256 >> release_notes.md
echo '```' >> release_notes.md
# Create release using gh cli
gh release create "$VERSION" \
--repo "$GITHUB_REPOSITORY" \
--title "Copepod $VERSION" \
--notes-file release_notes.md \
copepod-*