-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7d554a
commit 6039ab6
Showing
1 changed file
with
71 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: S3/CloudFront deployment beta.swcarpentry.carpentries.org | ||
|
||
on: | ||
push: | ||
branches: main | ||
schedule: | ||
- cron: '30 */6 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-website: | ||
if: github.repository_owner == 'carpentries' | ||
runs-on: ubuntu-22.04 | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true # Fetch Hugo themes (true OR recursive) | ||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v3 | ||
with: | ||
hugo-version: 'latest' | ||
extended: true | ||
|
||
- name: Install NPM deps | ||
run: | | ||
npm install @alpinejs/intersect | ||
- name: Update Theme | ||
run: | | ||
hugo mod get -u github.com/carpentries/carpentries-hugo-theme | ||
hugo mod npm pack | ||
- name: Build | ||
run: hugo --minify | ||
|
||
- name: List Built Files | ||
run: ls "$GITHUB_WORKSPACE/public/" | ||
|
||
- name: Deploy to AWS S3 | ||
id: deploy | ||
uses: fmichonneau/s3-sync-action@log-output | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
SOURCE_DIR: public/ | ||
|
||
- name: Invalidate CloudFront | ||
uses: chetan/invalidate-cloudfront-action@master | ||
env: | ||
PATHS: /* | ||
AWS_REGION: 'us-east-1' | ||
DISTRIBUTION: ${{ secrets.DISTRIBUTION }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |