diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae3de89..f362c59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,16 +16,22 @@ 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 \ No newline at end of file + + call-deploy-workflow: + uses: ./.github/workflows/deploy.yml + with: + artifact-name: website-${{ github.ref_name }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..ef10dcb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: Deploy site + +on: + workflow_call: + inputs: + artifact-name: + required: true + type: string + +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 }} + + - uses: aws-actions/configure-aws-credentials@v1 + 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 \ No newline at end of file