Skip to content

Commit

Permalink
Add deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mayo committed Jun 12, 2024
1 parent f545d1f commit 012cefa
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,25 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Zola environment
uses: taiki-e/install-action@v2
with:
tool: zola

- name: Build site
run: make build

- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: website-public
name: website-${{ github.ref_name }}
path: public/
# call-deploy-workflow:
# uses: ./.github/workflows/deploy.yml

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 }}
45 changes: 45 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy site

on:
workflow_call:
inputs:
artifact-name:
required: true
type: string
secrets:
AWS_IAM_ROLE_GITHUB:
required: true

permissions:
id-token: write

env:
AWS_REGION: us-east-1
S3_BUCKET: draft.oyam.ca

concurrency:
group: site-deploy-${{ github.ref_name }}
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Download the build artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: public

- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_GITHUB }}
role-session-name: GitHub-Action-Role
aws-region: ${{ env.AWS_REGION }}

- name: Upload Artifact to s3
run: aws s3 sync --acl public-read --delete public/ s3://${{ env.S3_BUCKET }}/


# invalidate-cache:
# runs-on: ubuntu-latest

0 comments on commit 012cefa

Please sign in to comment.