test new workflow #43
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
name: Build site with Zola | |
on: | |
push: | |
#paths-ignore: | |
branches: | |
- public-zola | |
concurrency: | |
group: site-build-${{ github.ref_name }} | |
cancel-in-progress: true | |
# env: | |
# AWS_REGION: us-east-1 | |
# S3_BUCKET: oyam.ca | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Zola environment | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: zola@0.19.2 | |
- name: Build site | |
run: make build | |
- name: Save website artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: website-${{ github.ref_name }} | |
path: public/ | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: draft-env | |
permissions: | |
id-token: write | |
steps: | |
- name: Download website artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: website-${{ github.ref_name }} | |
path: public | |
- name: Download tools | |
run: curl -LO https://github.com/mayo/oyam.ca-tools/releases/download/v0.0.1/sync_s3-x86_64-linux.zip | |
- name: Extract tools | |
run: unzip sync_s3-x86_64-linux.zip | |
- name: Setup Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_IAM_ROLE_GITHUB }} | |
role-session-name: GitHub-Action-Role | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Upload website to S3 | |
#run: aws s3 sync --acl public-read --delete public/ s3://${{ env.S3_BUCKET }}/ | |
run: ./sync_s3 --bucket ${{ vars.S3_BUCKET }} public/ -v -a public-read -d | tee upload.log | |
- name: Save sync artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sync-${{ github.ref_name }} | |
path: upload.log | |
purge-cache: | |
runs-on: ubuntu-latest | |
needs: deploy | |
environment: draft-env | |
steps: | |
- name: Download sync artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: sync-${{ github.ref_name }} | |
- name: Download tools | |
run: curl -LO https://github.com/mayo/oyam.ca-tools/releases/download/v0.0.1/cf_cache-x86_64-linux.zip | |
- name: Extract tools | |
run: unzip cf_cache-x86_64-linux.zip | |
- name: Do stuff | |
env: | |
CF_AUTH_TOKEN: ${{ secrets.CF_AUTH_TOKEN }} | |
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }} | |
run: cut -d ' ' -f 2 upload.log | ./cf_purge | |
# call-deploy-workflow: | |
# uses: ./.github/workflows/deploy.yml | |
# needs: build | |
# with: | |
# artifact-name: website-${{ github.ref_name }} | |
# secrets: | |
# AWS_IAM_ROLE_GITHUB: ${{ secrets.AWS_IAM_ROLE_GITHUB }} |