Files
gh-repo-bootstrap/.github/workflows/release.yml
T

146 lines
3.8 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the release (e.g., v1.0.0)'
required: true
type: string
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE26: 'true'
RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }}
jobs:
build-linux-amd64:
name: Build Linux amd64
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.3'
- name: Build
env:
CGO_ENABLED: '0'
GOOS: linux
GOARCH: amd64
run: go build -v -o gh-repo-bootstrap-linux-amd64 main.go
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: gh-repo-bootstrap-linux-amd64
path: gh-repo-bootstrap-linux-amd64
build-linux-arm64:
name: Build Linux arm64
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.3'
- name: Build
env:
CGO_ENABLED: '0'
GOOS: linux
GOARCH: arm64
run: go build -v -o gh-repo-bootstrap-linux-arm64 main.go
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: gh-repo-bootstrap-linux-arm64
path: gh-repo-bootstrap-linux-arm64
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.3'
- name: Build
run: go build -v -o gh-repo-bootstrap-windows-amd64.exe main.go
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: gh-repo-bootstrap-windows-amd64.exe
path: gh-repo-bootstrap-windows-amd64.exe
build-macos:
name: Build macOS
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.3'
- name: Build
run: go build -v -o gh-repo-bootstrap-darwin-arm64 main.go
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: gh-repo-bootstrap-darwin-arm64
path: gh-repo-bootstrap-darwin-arm64
release:
name: Create Release
needs:
- build-linux-amd64
- build-linux-arm64
- build-windows
- build-macos
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: bin-artifacts
- name: Prepare Release Assets and Checksums
run: |
mkdir release-assets
find bin-artifacts -type f -exec cp {} release-assets/ \;
cd release-assets
echo "## SHA256 Checksums" > ../release_notes.txt
echo "" >> ../release_notes.txt
echo "| Filename | SHA256 Checksum |" >> ../release_notes.txt
echo "| --- | --- |" >> ../release_notes.txt
for file in *; do
sha=$(sha256sum "$file" | cut -d' ' -f1)
echo "| \`$file\` | \`$sha\` |" >> ../release_notes.txt
done
cat ../release_notes.txt
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ env.RELEASE_TAG }}" \
--title "${{ env.RELEASE_TAG }}" \
--notes-file release_notes.txt \
release-assets/*