-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (79 loc) · 2.39 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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/deploy_aws_s3-x86_64-linux.zip
- name: Extract tools
run: unzip deploy_aws_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: Do stuff
env:
CF_AUTH_TOKEN: ${{ vars.CF_AUTH_TOKEN }}
run: cat upload.log
# 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 }}