Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move S3 binary build-deploy to GoReleaser #1228

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,45 +100,6 @@ jobs:

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

build_upload_aws_s3_binaries:
name: Build & Upload AWS S3 Binaries
runs-on: ubuntu-latest
needs: create_release
if: needs.create_release.outputs.is_prerelease == 'false'
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 'stable'
check-latest: true
- name: Build
id: build
run: |
PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin
make -j1 binary-linux-amd64 binary-linux-arm64 binary-darwin-amd64 binary-windows-amd64
mkdir -p ./.releases
cp ./output/binary/linux-amd64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_linux_amd64
cp ./output/binary/linux-amd64/bin/step ./.releases/step_latest_linux_amd64
cp ./output/binary/linux-arm64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_linux_arm64
cp ./output/binary/linux-arm64/bin/step ./.releases/step_latest_linux_arm64
cp ./output/binary/darwin-amd64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_darwin_amd64
cp ./output/binary/darwin-amd64/bin/step ./.releases/step_latest_darwin_amd64
cp ./output/binary/windows-amd64/bin/step ./.releases/step_${{ needs.create_release.outputs.version }}_windows.exe
cp ./output/binary/windows-amd64/bin/step ./.releases/step_latest_windows.exe
- name: Upload s3
id: upload-s3
uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83 # v0.5.1
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
SOURCE_DIR: ./.releases

update_reference_docs:
name: Update Reference Docs
runs-on: ubuntu-latest
Expand Down
56 changes: 44 additions & 12 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ before:
# - go generate ./...

builds:
-
id: default
- &COMMON
env:
- CGO_ENABLED=0
main: ./cmd/step/main.go
flags:
- -trimpath
ldflags:
- -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}}
-
<< : *COMMON
id: default
targets:
- darwin_amd64
- darwin_arm64
Expand All @@ -28,31 +35,44 @@ builds:
- linux_ppc64le
- windows_amd64
- windows_arm64
flags:
- -trimpath
main: ./cmd/step/main.go
binary: bin/step
ldflags:
- -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}}
-
# This build is for S3 binaries that follow our naming convention there.
<< : *COMMON
id: s3-versioned
targets:
- darwin_amd64
- darwin_arm64
- linux_amd64
- linux_arm64
- windows_amd64
binary: 'step_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
-
# This build is for S3 unversioned binaries that follow our naming convention there.
<< : *COMMON
id: s3-unversioned
targets:
- darwin_amd64
- darwin_arm64
- linux_amd64
- linux_arm64
- windows_amd64
binary: 'step_latest_{{ .Os }}_{{ .Arch }}'
-
# This build is specifically for nFPM targets (.deb and .rpm files).
# It's exactly the same as the default build above, except:
# - it only builds the archs we want to produce .deb and .rpm files for
# - the name of the output binary is step-cli
<< : *COMMON
id: nfpm
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
flags:
- -trimpath
main: ./cmd/step/main.go
binary: step-cli
ldflags:
- -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}}

archives:
- &ARCHIVE
Expand Down Expand Up @@ -239,6 +259,18 @@ release:
# - glob: ./glob/**/to/**/file/**/*
# - glob: ./glob/foo/to/bar/file/foobar/override_from_previous

blobs:
-
provider: s3
region: us-east-1
bucket: '{{ .Env.AWS_S3_BUCKET }}'
ids:
- s3-versioned
- s3-unversioned
acl: public-read
disable: '{{ neq .Prerelease "" }}'


winget:
-
# IDs of the archives to use.
Expand Down