-
Notifications
You must be signed in to change notification settings - Fork 46
89 lines (74 loc) · 2.39 KB
/
ci.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
---
name: OpenWISP Website CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
- new
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install test dependencies
run: |
yarn install
pip install -U pip setuptools wheel
pip install -r requirements.txt
- name: QA checks
run: ./run-qa-checks
- name: Build
run: make publish
- name: Setup Google Cloud
# if: ${{ github.event_name=='push' }}
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }}
project_id: ${{ secrets.GCS_PROJECT_ID }}
export_environment_variables: true
- name: 'Set up Cloud SDK'
if: ${{ github.event_name=='push' }}
uses: 'google-github-actions/setup-gcloud@v2'
- name: Deploy pages to openwisp.org
if: ${{ github.event_name=='push' }}
run: gsutil -m rsync -r ${{ env.SRC_URL }} ${{ env.DST_URL }}
env:
SRC_URL: /home/runner/work/OpenWISP-Website/OpenWISP-Website/output/
DST_URL: gs://${{ secrets.GCS_WEBSITE_BUCKET_NAME }}/
invalidate-cache:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.result == 'success' }} && ${{ github.event_name=='push' }}
steps:
- name: Authenticate to Google Cloud
if: ${{ github.event_name=='push' }}
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }}
project_id: ${{ secrets.GCS_PROJECT_ID }}
export_environment_variables: true
- name: Invalid CDN cache on GCP
if: ${{ github.event_name=='push' }}
uses: stefanodotit/github-actions-invalidate-gcp-cdn@v1
with:
load_balancer_name: ${{ secrets.GCS_MAIN_LOAD_BALANCER_NAME }}
host: openwisp.org
path: '/*'