-
-
Notifications
You must be signed in to change notification settings - Fork 748
94 lines (79 loc) · 2.72 KB
/
publish-website.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
name: Publish Website
# When to trigger the workflow
on:
push:
branches:
- main
paths:
- .github/workflows/publish-website.yml
- .docker/website/**
- website/**
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ secrets.CONTAINER_REG_URL }}
username: ${{ secrets.CONTAINER_REG_USERNAME }}
password: ${{ secrets.CONTAINER_REG_PASSWORD }}
- run: echo ${{ secrets.CONTAINER_REG_URL }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "yarn"
cache-dependency-path: "website/yarn.lock"
- name: Cache Yarn Packages
uses: actions/cache@v4
with:
path: |
website/.yarn/cache
website/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('website/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Packages
run: yarn --immutable --network-timeout 100000
working-directory: website
- name: Delete Free Icons
run: |
rm -rf src/images/icons
working-directory: website
- name: Unzip Pro Icons
run: |
sudo apt-get install -y unzip
unzip -P ${{ secrets.ICON_PASSWORD }} src/images/icons.zip -d src/images/
working-directory: website
- name: Clean Website
run: yarn clean
working-directory: website
- name: Build Website
run: yarn build --prefix-paths
working-directory: website
- name: Build WebSite Container
uses: docker/build-push-action@v5
with:
context: .
file: .docker/website/dockerfile
push: true
tags: ${{ secrets.CONTAINER_REG_DOMAIN }}/ccc-website-${{ github.ref_name }}:${{ github.run_id }}
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v3
with:
app-name: ccc-p-us1-website
slot-name: "production"
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
images: ${{ secrets.CONTAINER_REG_DOMAIN }}/ccc-website-${{ github.ref_name }}:${{ github.run_id }}
- name: Purge CDN Cache
run: |
curl --request POST \
--url https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${{ secrets.CLOUDFLARE_AUTH_TOKEN }}' \
--data '{ "purge_everything": true }'