-
Notifications
You must be signed in to change notification settings - Fork 4
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 #69 from galaxyproject/build-on-prod
Publish on merge to production branch
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
coverage/* | ||
|
||
venv | ||
coverage |
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,46 @@ | ||
name: Deploy to S3 and CloudFront | ||
|
||
on: | ||
push: | ||
branches: | ||
# - main # todo, consolidate auth approach and merge dev-deploy into this. | ||
- production | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
environment: ${{ github.ref == 'refs/heads/production' && 'production' || 'development' }} | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20.10.0" | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Build Next.js Site | ||
env: | ||
NEXT_PUBLIC_BASE_PATH: "" | ||
run: npm run build:local | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Sync to S3 | ||
env: | ||
SRCDIR: out/ | ||
run: | | ||
aws s3 sync $SRCDIR s3://${{ secrets.S3_BUCKET_NAME }} --delete | ||
- name: Invalidate CloudFront Cache | ||
run: | | ||
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" |