-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from jku/add-gcs-upload
Add a GCS deploy workflow
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy repository to GCS | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
gcp_workload_identity_provider: | ||
required: true | ||
type: string | ||
gcp_service_account: | ||
required: true | ||
type: string | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
deploy-to-gcs: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: 'write' # For authenticating with the GitHub workflow identity | ||
|
||
steps: | ||
- uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | ||
with: | ||
name: github-pages | ||
|
||
- name: Prepare data for upload | ||
run: | | ||
# Extract the github-pages arcive into ./repository/ | ||
mkdir repository | ||
tar --directory repository -xvf artifact.tar | ||
- uses: google-github-actions/auth@a6e2e39c0a0331da29f7fd2c2a20a427e8d3ad1f # v2.1.1 | ||
with: | ||
token_format: access_token | ||
workload_identity_provider: ${{ inputs.gcp_workload_identity_provider }} | ||
service_account: ${{ inputs.gcp_service_account }} | ||
|
||
- uses: google-github-actions/setup-gcloud@98ddc00a17442e89a24bbf282954a3b65ce6d200 # v2.1.0 | ||
with: | ||
project_id: projectsigstore-staging | ||
|
||
- name: Upload repository to GCS | ||
run: | | ||
BUCKET="gs://tuf-root-staging/" | ||
LOAD_BALANCER="tuf-repo-cdn-lb" | ||
# Upload metadata, make sure we upload timestamp last | ||
gcloud storage rsync --cache-control=no-store --recursive --exclude=timestamp.json \ | ||
repository/ $BUCKET | ||
gcloud storage cp --cache-control=no-store repository/timestamp.json $BUCKET | ||
# invalidate CDN cache | ||
gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --path "/*" --async |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters