Skip to content

Commit 9d4009d

Browse files
committed
refactor: use reusable workflows from cli-workflow-template
1 parent fb86a4c commit 9d4009d

2 files changed

Lines changed: 5 additions & 72 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,5 @@ on:
77
branches: [main]
88

99
jobs:
10-
test:
11-
strategy:
12-
matrix:
13-
os: [ubuntu-latest, macos-latest]
14-
runs-on: ${{ matrix.os }}
15-
steps:
16-
- uses: actions/checkout@v6
17-
18-
- uses: actions/setup-go@v6
19-
with:
20-
go-version-file: 'go.mod'
21-
cache: true
22-
23-
- run: test -z "$(gofmt -l .)"
24-
- run: go vet ./...
25-
- run: go test ./... -race
26-
- run: go build ./...
10+
ci:
11+
uses: thedavidweng/cli-workflow-template/.github/workflows/go-ci.yml@main

.github/workflows/release.yml

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,7 @@ on:
55
tags:
66
- 'v*'
77

8-
permissions:
9-
contents: write
10-
id-token: write # Required for Sigstore keyless signing via OIDC
11-
128
jobs:
13-
goreleaser:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: Configure Git
17-
run: |
18-
git config --global init.defaultBranch main
19-
git config --global advice.detachedHead false
20-
21-
- name: Checkout
22-
uses: actions/checkout@v5
23-
with:
24-
fetch-depth: 0
25-
26-
- name: Set up Go
27-
uses: actions/setup-go@v6
28-
with:
29-
go-version-file: 'go.mod'
30-
31-
- name: Install Cosign
32-
uses: sigstore/cosign-installer@v4.1.2
33-
34-
- name: Install Syft
35-
uses: anchore/sbom-action/download-syft@v0
36-
37-
- name: Run tests
38-
run: go test ./... -race
39-
40-
- name: Verify Homebrew tap token
41-
env:
42-
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
43-
run: |
44-
if [ -z "$GH_TOKEN" ]; then
45-
echo "::error title=Missing HOMEBREW_TAP_GITHUB_TOKEN::Create a GitHub token that can write contents to thedavidweng/homebrew-tap before running a release."
46-
exit 1
47-
fi
48-
49-
can_push="$(gh api repos/thedavidweng/homebrew-tap --jq '.permissions.push')"
50-
if [ "$can_push" != "true" ]; then
51-
echo "::error title=Invalid HOMEBREW_TAP_GITHUB_TOKEN::The token must have write access to thedavidweng/homebrew-tap. For a fine-grained PAT, select that repository and grant Contents: Read and write."
52-
exit 1
53-
fi
54-
55-
- name: Run GoReleaser
56-
uses: goreleaser/goreleaser-action@v7
57-
with:
58-
distribution: goreleaser
59-
version: '~> v2'
60-
args: release --clean
61-
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
9+
release:
10+
uses: thedavidweng/cli-workflow-template/.github/workflows/go-release.yml@main
11+
secrets: inherit

0 commit comments

Comments
 (0)