mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-11 07:18:03 -05:00
## CHANGES - Upgrade GitHub Actions to latest versions (v6, v21) - Add modernization check step in CI workflow - Replace strings manipulation with `strings.CutPrefix` and `strings.CutSuffix` - Replace manual loops with `slices.Contains` for validation - Use `strings.SplitSeq` for iterator-based string splitting - Replace `bytes.TrimPrefix` with `bytes.CutPrefix` for clarity - Use `strings.Builder` instead of string concatenation - Replace `fmt.Sprintf` with `fmt.Appendf` for efficiency - Simplify padding calculation with `max` builtin
58 lines
1.3 KiB
YAML
58 lines
1.3 KiB
YAML
name: Go Release
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types: [tag_created]
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
test:
|
|
name: Run tests
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: ./go.mod
|
|
|
|
- name: Run tests
|
|
run: go test -v ./...
|
|
|
|
build:
|
|
# only run in main upstream repo
|
|
if: ${{ github.repository_owner == 'danielmiessler' }}
|
|
name: Build & Release with Goreleaser
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: ./go.mod
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v6
|
|
with:
|
|
distribution: goreleaser
|
|
args: release --clean
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Update Release Description
|
|
run: go run ./cmd/generate_changelog --release ${{ github.event.client_payload.tag || github.ref_name }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|