Skip to content

Commit 72e9a65

Browse files
dpark01claude
andcommitted
Add automated GCS deployment via GitHub Actions
Implements CI/CD pipeline to deploy viral-references data to Google Cloud Storage: - Workflow deploys on push to main (gs://viral-references/main/) - Workflow deploys on version tags (gs://viral-references/vX.Y.Z/) - Uses gcloud storage rsync to exclude dotfiles/dotdirs - Updates GitHub release notes with deployment URLs for tagged releases - README updated with GCS access documentation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 554c1cf commit 72e9a65

2 files changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Deploy to Google Cloud Storage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*.*.*'
9+
10+
permissions:
11+
contents: write # Required for updating GitHub releases on tagged deployments
12+
13+
jobs:
14+
deploy:
15+
name: Deploy to GCS
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Determine deployment path
23+
id: deploy-path
24+
run: |
25+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
26+
# Extract version from tag (e.g., refs/tags/v1.0.0 -> v1.0.0)
27+
VERSION="${GITHUB_REF#refs/tags/}"
28+
echo "path=$VERSION" >> $GITHUB_OUTPUT
29+
echo "is_tag=true" >> $GITHUB_OUTPUT
30+
echo "Deploying tagged release: $VERSION"
31+
else
32+
# Main branch deployment
33+
echo "path=main" >> $GITHUB_OUTPUT
34+
echo "is_tag=false" >> $GITHUB_OUTPUT
35+
echo "Deploying main branch"
36+
fi
37+
38+
- name: Authenticate to Google Cloud
39+
uses: google-github-actions/auth@v2
40+
with:
41+
credentials_json: ${{ secrets.GCS_DEPLOY_SA_KEY }}
42+
43+
- name: Setup gcloud CLI
44+
uses: google-github-actions/setup-gcloud@v2
45+
46+
- name: Deploy to GCS
47+
env:
48+
GCS_BUCKET: viral-references
49+
DEPLOY_PATH: ${{ steps.deploy-path.outputs.path }}
50+
run: |
51+
echo "Syncing to gs://$GCS_BUCKET/$DEPLOY_PATH/"
52+
gcloud storage rsync . "gs://$GCS_BUCKET/$DEPLOY_PATH/" \
53+
--recursive \
54+
--delete-unmatched-destination-objects \
55+
--exclude=".??*"
56+
echo "Deployment complete!"
57+
58+
- name: Verify deployment
59+
env:
60+
GCS_BUCKET: viral-references
61+
DEPLOY_PATH: ${{ steps.deploy-path.outputs.path }}
62+
run: |
63+
echo "Deployed files:"
64+
gcloud storage ls -r "gs://$GCS_BUCKET/$DEPLOY_PATH/" | head -20
65+
echo ""
66+
echo "Deployment URL: gs://$GCS_BUCKET/$DEPLOY_PATH/"
67+
68+
- name: Update GitHub release notes
69+
if: steps.deploy-path.outputs.is_tag == 'true'
70+
env:
71+
GH_TOKEN: ${{ github.token }}
72+
TAG_NAME: ${{ github.ref_name }}
73+
GCS_BUCKET: viral-references
74+
DEPLOY_PATH: ${{ steps.deploy-path.outputs.path }}
75+
run: |
76+
# Check if release exists for this tag
77+
if gh release view "$TAG_NAME" &>/dev/null; then
78+
echo "Release exists for $TAG_NAME, updating with deployment URL"
79+
80+
# Get existing release notes
81+
EXISTING_NOTES=$(gh release view "$TAG_NAME" --json body --jq .body)
82+
83+
# Append deployment info if not already present
84+
if [[ "$EXISTING_NOTES" != *"gs://$GCS_BUCKET/$DEPLOY_PATH/"* ]]; then
85+
DEPLOYMENT_NOTE="\n\n---\n\n**Deployment**: Available at \`gs://$GCS_BUCKET/$DEPLOY_PATH/\`"
86+
gh release edit "$TAG_NAME" --notes "${EXISTING_NOTES}${DEPLOYMENT_NOTE}"
87+
echo "Release notes updated with deployment URL"
88+
else
89+
echo "Deployment URL already present in release notes"
90+
fi
91+
else
92+
echo "No release found for $TAG_NAME, skipping release update"
93+
fi

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
11
# viral-references
22
Reference genomes for viral genomics
3+
4+
## Accessing the Data
5+
6+
This repository is automatically deployed to Google Cloud Storage for public access.
7+
8+
### Latest Version (main branch)
9+
```
10+
gs://viral-references/main/assembly/reference_genomes.tsv
11+
gs://viral-references/main/annotation/vadr/vadr-by-taxid.tsv
12+
gs://viral-references/main/typing/nextclade-by-taxid.tsv
13+
gs://viral-references/main/submission/table2asn-prohibited.tsv
14+
```
15+
16+
### Versioned Releases
17+
Pinned versions are available for reproducible workflows:
18+
```
19+
gs://viral-references/v1.0.0/assembly/reference_genomes.tsv
20+
gs://viral-references/v1.1.0/assembly/reference_genomes.tsv
21+
```
22+
23+
### Deployment
24+
Data is automatically deployed via GitHub Actions:
25+
- Every push to `main` updates `gs://viral-references/main/`
26+
- Version tags (e.g., `v1.0.0`) create immutable snapshots at `gs://viral-references/v1.0.0/`

0 commit comments

Comments
 (0)