This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
157 lines (133 loc) · 4.29 KB
/
build-and-deploy.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build and Deploy Sites
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
env:
RUNNER_TOOL_CACHE: /toolcache
jobs:
files_changed:
name: Get changed files
runs-on: ubuntu-latest
outputs:
brandonb_ca: ${{ steps.changes.outputs.brandonb_ca }}
ve7tzb_ca: ${{ steps.changes.outputs.ve7tzb_ca }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
brandonb_ca:
- 'brandonb.ca/**'
ve7tzb_ca:
- 've7tzb.ca/**'
build-brandonb_ca:
name: Build and Deploy brandonb.ca
runs-on: ubuntu-latest
needs:
- files_changed
if: ${{ needs.files_changed.outputs.brandonb_ca == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
id: get-awspublish-hash
with:
patterns: |-
**/.awspublish-brandonb-web-media
- uses: actions/cache@v4
with:
path: .awspublish-brandonb-web-media
key: ${{ runner.os }}-awspublish-cache-${{ steps.get-awspublish-hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-awspublish-cache-
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3'
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install ruby dependencies
run: gem install bundler && bundle install
- name: Install js dependencies
run: npm ci
- name: Build and deploy
run: npm run brandonb.ca:deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
FLICKR_CONSUMER_KEY: ${{ secrets.FLICKR_CONSUMER_KEY }}
FLICKR_CONSUMER_SECRET: ${{ secrets.FLICKR_CONSUMER_SECRET }}
FLICKR_OAUTH_TOKEN: ${{ secrets.FLICKR_OAUTH_TOKEN }}
FLICKR_OAUTH_TOKEN_SECRET: ${{ secrets.FLICKR_OAUTH_TOKEN_SECRET }}
- uses: sarisia/actions-status-discord@v1
if: success()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "Successfully deployed brandonb.ca"
color: 0x28a745
- uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "Failed to deploy brandonb.ca"
color: 0xdc3545
build-ve7tzb_ca:
name: Build and Deploy ve7tzb.ca
runs-on: ubuntu-latest
needs:
- files_changed
if: ${{ needs.files_changed.outputs.ve7tzb_ca == 'true' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/[email protected]
id: get-awspublish-hash
with:
patterns: |-
**/.awspublish-brandonb-web-media
- uses: actions/cache@v4
with:
path: .awspublish-brandonb-web-media
key: ${{ runner.os }}-awspublish-cache-${{ steps.get-awspublish-hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-awspublish-cache-
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3'
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install ruby dependencies
run: gem install bundler && bundle install
- name: Install js dependencies
run: npm ci
- name: Build and deploy
run: npm run ve7tzb.ca:deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- uses: sarisia/actions-status-discord@v1
if: success()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "Successfully deployed ve7tzb.ca"
color: 0x28a745
- uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "Failed to deploy ve7tzb.ca"
color: 0xdc3545