Skip to content

Commit b2d8493

Browse files
committed
Move S3 binary build-deploy to GoReleaser
1 parent d043ac8 commit b2d8493

File tree

2 files changed

+44
-51
lines changed

2 files changed

+44
-51
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -100,45 +100,6 @@ jobs:
100100

101101
# All jobs below this are for full releases (non release candidates e.g. *-rc.*)
102102

103-
build_upload_aws_s3_binaries:
104-
name: Build & Upload AWS S3 Binaries
105-
runs-on: ubuntu-latest
106-
needs: create_release
107-
if: needs.create_release.outputs.is_prerelease == 'false'
108-
steps:
109-
- name: Checkout
110-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
111-
- name: Setup Go
112-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
113-
with:
114-
go-version: 'stable'
115-
check-latest: true
116-
- name: Build
117-
id: build
118-
run: |
119-
PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin
120-
make -j1 binary-linux-amd64 binary-linux-arm64 binary-darwin-amd64 binary-windows-amd64
121-
mkdir -p ./.releases
122-
cp ./output/binary/linux-amd64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_linux_amd64
123-
cp ./output/binary/linux-amd64/bin/step ./.releases/step_latest_linux_amd64
124-
cp ./output/binary/linux-arm64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_linux_arm64
125-
cp ./output/binary/linux-arm64/bin/step ./.releases/step_latest_linux_arm64
126-
cp ./output/binary/darwin-amd64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_darwin_amd64
127-
cp ./output/binary/darwin-amd64/bin/step ./.releases/step_latest_darwin_amd64
128-
cp ./output/binary/windows-amd64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_windows.exe
129-
cp ./output/binary/windows-amd64/bin/step ./.releases/step_latest_windows.exe
130-
- name: Upload s3
131-
id: upload-s3
132-
uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83 # v0.5.1
133-
with:
134-
args: --acl public-read --follow-symlinks
135-
env:
136-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
137-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
138-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
139-
AWS_REGION: us-east-1
140-
SOURCE_DIR: ./.releases
141-
142103
update_reference_docs:
143104
name: Update Reference Docs
144105
runs-on: ubuntu-latest

.goreleaser.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ before:
99
# - go generate ./...
1010

1111
builds:
12-
-
13-
id: default
12+
- &COMMON
1413
env:
1514
- CGO_ENABLED=0
15+
main: ./cmd/step/main.go
16+
flags:
17+
- -trimpath
18+
ldflags:
19+
- -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}}
20+
-
21+
<< : *COMMON
22+
id: default
1623
targets:
1724
- darwin_amd64
1825
- darwin_arm64
@@ -28,31 +35,44 @@ builds:
2835
- linux_ppc64le
2936
- windows_amd64
3037
- windows_arm64
31-
flags:
32-
- -trimpath
33-
main: ./cmd/step/main.go
3438
binary: bin/step
3539
ldflags:
3640
- -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}}
41+
-
42+
# This build is for S3 binaries that follow our naming convention there.
43+
<< : *COMMON
44+
id: s3-versioned
45+
targets:
46+
- darwin_amd64
47+
- darwin_arm64
48+
- linux_amd64
49+
- linux_arm64
50+
- windows_amd64
51+
binary: 'step_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
52+
-
53+
# This build is for S3 unversioned binaries that follow our naming convention there.
54+
<< : *COMMON
55+
id: s3-unversioned
56+
targets:
57+
- darwin_amd64
58+
- darwin_arm64
59+
- linux_amd64
60+
- linux_arm64
61+
- windows_amd64
62+
binary: 'step_latest_{{ .Os }}_{{ .Arch }}'
3763
-
3864
# This build is specifically for nFPM targets (.deb and .rpm files).
3965
# It's exactly the same as the default build above, except:
4066
# - it only builds the archs we want to produce .deb and .rpm files for
4167
# - the name of the output binary is step-cli
68+
<< : *COMMON
4269
id: nfpm
43-
env:
44-
- CGO_ENABLED=0
4570
goos:
4671
- linux
4772
goarch:
4873
- amd64
4974
- arm64
50-
flags:
51-
- -trimpath
52-
main: ./cmd/step/main.go
5375
binary: step-cli
54-
ldflags:
55-
- -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}}
5676

5777
archives:
5878
- &ARCHIVE
@@ -239,6 +259,18 @@ release:
239259
# - glob: ./glob/**/to/**/file/**/*
240260
# - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
241261

262+
blobs:
263+
-
264+
provider: s3
265+
region: us-east-1
266+
bucket: '{{ .Env.AWS_S3_BUCKET }}'
267+
ids:
268+
- s3-versioned
269+
- s3-unversioned
270+
acl: public-read
271+
disable: '{{ neq .Prerelease "" }}'
272+
273+
242274
winget:
243275
-
244276
# IDs of the archives to use.

0 commit comments

Comments
 (0)