-
Notifications
You must be signed in to change notification settings - Fork 389
108 lines (104 loc) · 3.36 KB
/
release.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
name: Release Device Repository
on:
push:
branches:
- master
jobs:
pages:
name: Release Pages
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.22'
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.83.1'
# extended: true
- name: Download Go dependencies
run: |
cd website/
make go.deps
- name: Install Node.js dependencies
run: npm ci
- name: Build content
run: |
cd website/
make go.build
- name: Build assets
run: |
cd website/
yarn install
yarn build
env:
BASE_URL: https://www.thethingsnetwork.org
BASE_PATH: /device-repository
- name: Build Hugo
run: |
cd website/
make hugo.build.public
env:
BASE_URL: https://www.thethingsnetwork.org
BASE_PATH: /device-repository
- name: Deploy Device Repository to Github pages
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: website/public
- name: Make devices.csv
run: make devices.csv
- name: Sync devices.csv to airtable
run: |
curl -X POST ${{ secrets.AIRTABLE_DEVICES_API_ENDPOINT }} \
-H "Authorization: Bearer ${{ secrets.AIRTABLE_DEVICES_API_KEY }}" \
-H "Content-Type: text/csv" \
--data-binary "@bin/devices.csv"
csv:
name: Upload CSV to Airtable
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Node.js dependencies
run: npm ci
- name: Make devices.csv
run: make devices.csv
- name: Upload to Airtable
run: |
curl -X POST ${{ secrets.AIRTABLE_DEVICES_API_ENDPOINT }} \
-H "Authorization: Bearer ${{ secrets.AIRTABLE_DEVICES_API_KEY }}" \
-H "Content-Type: text/csv" \
--data-binary "@bin/devices.csv"
schema:
name: Upload schema
runs-on: ubuntu-20.04
permissions:
contents: read
id-token: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: 'arn:aws:iam::${{ secrets.AWS_USER_ID }}:role/${{ secrets.AWS_ROLE_NAME }}'
role-session-name: '${{ github.job }}-${{ github.run_id }}'
- name: Upload schema
run: |
aws s3 cp schema.json s3://schema.thethings.network/devicerepository/1/schema --content-type application/json
aws s3 cp lib/payload.json s3://schema.thethings.network/devicerepository/1/payload/schema --content-type application/json
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_SCHEMA }} --paths "/devicerepository/1/*"