Skip to content

Merge pull request #341 from AppSprout-dev/release-please--branches--… #26

Merge pull request #341 from AppSprout-dev/release-please--branches--…

Merge pull request #341 from AppSprout-dev/release-please--branches--… #26

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: macos-14
goos: darwin
goarch: arm64
name: darwin_arm64
- os: ubuntu-latest
goos: linux
goarch: amd64
name: linux_amd64
- os: windows-latest
goos: windows
goarch: amd64
name: windows_amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build
shell: bash
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION=${GITHUB_REF_NAME#v}
BINARY=mnemonic
if [ "${{ matrix.goos }}" = "windows" ]; then BINARY=mnemonic.exe; fi
go build -ldflags "-s -w -X main.Version=${VERSION}" -o "${BINARY}" ./cmd/mnemonic
- name: Package
shell: bash
run: |
VERSION=${GITHUB_REF_NAME#v}
if [ "${{ matrix.goos }}" = "windows" ]; then
ARCHIVE="mnemonic_${VERSION}_${{ matrix.name }}.zip"
7z a "${ARCHIVE}" mnemonic.exe README.md LICENSE config.example.yaml docs/
else
ARCHIVE="mnemonic_${VERSION}_${{ matrix.name }}.tar.gz"
tar czf "${ARCHIVE}" mnemonic README.md LICENSE config.example.yaml docs/
fi
echo "ARCHIVE=${ARCHIVE}" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: binary-${{ matrix.name }}
path: ${{ env.ARCHIVE }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: dist/
merge-multiple: true
- name: Generate checksums
working-directory: dist
run: |
shopt -s nullglob
sha256sum *.tar.gz *.zip > checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/*.zip
dist/checksums.txt
generate_release_notes: true
draft: false