Skip to content

Commit f68cc0a

Browse files
hfcstocktonChris Stockton
authored
ci: upload artifacts to s3 on release (#2137)
Uses a special S3 bucket to upload the artifacts for internal Supabase use. --------- Co-authored-by: Chris Stockton <[email protected]> Co-authored-by: Chris Stockton <[email protected]>
1 parent db3ce12 commit f68cc0a

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,15 @@ jobs:
9090
set -ex
9191
9292
RELEASE_VERSION=$RELEASE_VERSION make deps
93-
RELEASE_VERSION=$RELEASE_VERSION make all
93+
RELEASE_VERSION=$RELEASE_VERSION make all build-strip
94+
9495
ln -s auth gotrue
9596
tar -czvf auth-v$RELEASE_VERSION-x86.tar.gz auth gotrue migrations/
9697
mv auth-arm64 auth
9798
tar -czvf auth-v$RELEASE_VERSION-arm64.tar.gz auth gotrue migrations/
9899
99-
# Create a "supafast" tarball that can be used by supabase-admin-api to upgrade Auth quickly
100-
rm gotrue
101-
mv auth gotrue
102-
tar -czvf auth-v$RELEASE_VERSION.supafast-arm64.tar.gz gotrue migrations/
100+
mv auth-arm64-strip auth
101+
tar -cf - auth gotrue migrations/ | xz -T0 -9e -C crc64 > auth-v$RELEASE_VERSION-arm64.tar.xz
103102
104103
- name: Generate checksums
105104
if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}
@@ -110,7 +109,7 @@ jobs:
110109
local hash_type=$1
111110
local hash_cmd=$2
112111
echo "### ${hash_type}" >> checksums.txt
113-
for file in auth-v$RELEASE_VERSION*.tar.gz; do
112+
for file in auth-v$RELEASE_VERSION*.tar.{gz,xz}; do
114113
echo "\`$file\`:" >> checksums.txt
115114
echo "\`\`\`" >> checksums.txt
116115
$hash_cmd "$file" | awk '{print $1}' >> checksums.txt
@@ -124,6 +123,24 @@ jobs:
124123
generate_checksums "SHA1" "sha1sum"
125124
generate_checksums "SHA256" "sha256sum"
126125
126+
- name: GitHub OIDC Auth
127+
if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}
128+
uses: aws-actions/[email protected]
129+
with:
130+
aws-region: ap-southeast-1
131+
role-to-assume: arn:aws:iam::${{ secrets.SHARED_SERVICES_AWS_ACCOUNT_ID }}:role/supabase-github-oidc-role
132+
role-session-name: shared-services-jump
133+
134+
- name: Assume destination role
135+
uses: aws-actions/[email protected]
136+
if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}
137+
with:
138+
aws-region: ap-southeast-1
139+
role-to-assume: arn:aws:iam::${{ secrets.SHARED_SERVICES_AWS_ACCOUNT_ID }}:role/supabase-auth-artifacts-role-936f98a
140+
role-skip-session-tagging: true
141+
role-session-name: upload-assets
142+
role-chaining: true
143+
127144
- name: Upload release artifacts
128145
if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}
129146
run: |
@@ -135,7 +152,7 @@ jobs:
135152
CHECKSUM_CONTENT=$(cat checksums.txt)
136153
137154
RELEASE_NOTES=$(printf "This is a release candidate. See release-please PR #%s for context.\n\n%s\n" "$PR_NUMBER" "$CHECKSUM_CONTENT")
138-
155+
139156
GH_TOKEN='${{ github.token }}' gh release \
140157
create $RELEASE_NAME \
141158
--title "v$RELEASE_VERSION" \
@@ -171,7 +188,9 @@ jobs:
171188
FULL_NOTES=$(printf "%s\n\n%s\n" "$EXISTING_NOTES" "$CHECKSUM_CONTENT")
172189
GH_TOKEN='${{ github.token }}' gh release edit $RELEASE_NAME -n "$FULL_NOTES"
173190
174-
GH_TOKEN='${{ github.token }}' gh release upload $RELEASE_NAME ./auth-v$RELEASE_VERSION-x86.tar.gz ./auth-v$RELEASE_VERSION-arm64.tar.gz ./auth-v$RELEASE_VERSION.supafast-arm64.tar.gz
191+
GH_TOKEN='${{ github.token }}' gh release upload $RELEASE_NAME ./auth-v$RELEASE_VERSION-x86.tar.gz ./auth-v$RELEASE_VERSION-arm64.tar.gz ./auth-v$RELEASE_VERSION-arm64.tar.xz
192+
193+
aws s3 cp ./auth-v$RELEASE_VERSION-arm64.tar.xz s3://supabase-internal-artifacts/auth/$RELEASE_VERSION/
175194
176195
publish:
177196
needs:

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ build: deps ## Build the binary.
2323
CGO_ENABLED=0 go build $(FLAGS)
2424
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(FLAGS) -o auth-arm64
2525

26+
build-strip: deps ## Build a stripped binary.
27+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build \
28+
$(FLAGS) -ldflags "-s -w" -o auth-arm64-strip
29+
2630
dev-deps: ## Install developer dependencies
2731
@go install github.com/gobuffalo/pop/soda@latest
2832
@go install github.com/securego/gosec/v2/cmd/gosec@latest

0 commit comments

Comments
 (0)