-
-
Notifications
You must be signed in to change notification settings - Fork 59
72 lines (63 loc) · 2.4 KB
/
Copy pathrelease-please.yml
File metadata and controls
72 lines (63 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release-please:
strategy:
matrix:
go: ["1.25.2"]
os: [macos-latest]
runs-on: ${{ matrix.os }}
steps:
# Create a release using the release-please action.
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
release-type: go
# Checkout the repository.
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
# Set up Go.
- uses: actions/setup-go@v5
if: ${{ steps.release.outputs.release_created }}
with:
go-version: ${{ matrix.go }}
# Build artifacts for multiple platforms.
- name: Build govim artifacts
if: ${{ steps.release.outputs.release_created }}
run: |
mkdir -p bin
# Build for darwin-arm64
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/y3owk1n/govim/internal/cli.Version=${{ steps.release.outputs.tag_name }}" -trimpath -o bin/govim-darwin-arm64 cmd/govim/main.go
# Build for darwin-amd64
env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/y3owk1n/govim/internal/cli.Version=${{ steps.release.outputs.tag_name }}" -trimpath -o bin/govim-darwin-amd64 cmd/govim/main.go
# Generate SHA256 checksum files for each artifact
- name: Generate Checksums
if: ${{ steps.release.outputs.release_created }}
run: |
cd bin
for file in govim-*; do
shasum -a 256 "$file" | awk '{print $1}' > "$file.sha256"
done
ls -l
# Upload release artifacts and their respective checksum files
- name: Upload Release Artifacts
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
run: |
for file in bin/govim-*; do
if [[ "$file" != *.sha256 ]]; then
gh release upload "${{ steps.release.outputs.tag_name }}" "$file"
gh release upload "${{ steps.release.outputs.tag_name }}" "$file.sha256"
fi
done