-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (63 loc) · 2.97 KB
/
Copy pathrelease.install-script.yml
File metadata and controls
71 lines (63 loc) · 2.97 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
name: release.install-script
# Publishes scripts/connect*.sh to the CDN behind https://get.doublezero.xyz/connect
# (and /connect-testnet, /connect-devnet). Uploads to the SAME doublezero-install S3
# bucket + CloudFront distribution that serves the doublezero installer (managed in
# the doublezero infra repo), under the connect* keys. Auth is GitHub OIDC into the
# main-only deploy role (no static keys).
#
# PREREQUISITE: the deploy role's OIDC trust policy must be extended to also trust
# this repo (repo:malbeclabs/doublezero-edge-connect:*); until then the
# configure-aws-credentials step fails. See the design doc / infra runbook.
on:
push:
branches: [main]
paths:
- "scripts/connect.sh"
- "scripts/connect-testnet.sh"
- "scripts/connect-devnet.sh"
- "shred-proxy/packaging/install.sh"
- ".github/workflows/release.install-script.yml"
workflow_dispatch:
permissions:
id-token: write # assume the AWS deploy role via OIDC
contents: read
env:
AWS_REGION: us-east-1
BUCKET: doublezero-install
# Account-scoped infra (deploy-role ARN incl. the AWS account ID, and the CloudFront
# distribution id) lives in repo Actions Variables so it is not baked into a public
# workflow. Set both under Settings -> Secrets and variables -> Actions -> Variables:
# DEPLOY_ROLE = arn:aws:iam::<account-id>:role/github-doublezero-install-deploy
# DISTRIBUTION_ID = <cloudfront-distribution-id>
DEPLOY_ROLE: ${{ vars.DEPLOY_ROLE }}
DISTRIBUTION_ID: ${{ vars.DISTRIBUTION_ID }}
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1
with:
role-to-assume: ${{ env.DEPLOY_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload connect scripts
run: |
for variant in "connect:connect.sh" "connect-testnet:connect-testnet.sh" "connect-devnet:connect-devnet.sh"; do
key="${variant%%:*}"; file="scripts/${variant##*:}"
aws s3 cp "$file" "s3://${BUCKET}/${key}" \
--content-type text/x-shellscript \
--cache-control "public,max-age=120"
done
# The standalone shred-proxy installer is served under the same bucket at
# https://get.doublezero.xyz/shred-proxy. It downloads the prebuilt binary published by
# release.shred-proxy.yml, so it is decoupled from the Docker-image release cadence.
- name: Upload shred-proxy installer
run: |
aws s3 cp shred-proxy/packaging/install.sh "s3://${BUCKET}/shred-proxy" \
--content-type text/x-shellscript \
--cache-control "public,max-age=120"
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id "$DISTRIBUTION_ID" \
--paths '/connect' '/connect-testnet' '/connect-devnet' '/shred-proxy'