-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 2.73 KB
/
master.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
name: Master
on:
push:
branches: ['master']
jobs:
test:
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
strategy:
matrix:
package:
- archive
- base-node
- common-archive-client
- common-data
- common-postgres
- configurator
- gatherer-http
- gatherer-stdin
- infra-postgres
- infra-redis
- listener
- publisher
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npx nx run-many --target=lint,test --projects=${{ matrix.package }} --output-style=stream
build-base-images:
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }}
needs: test
permissions:
contents: write
packages: write
strategy:
matrix:
args:
- context: .
image: ghcr.io/unkhz/ruuvipuserrin-base-node
uses: ./.github/workflows/build-package.yml
with:
context: ${{ matrix.args.context }}
image: ${{ matrix.args.image }}
build-package-images:
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }}
needs: build-base-images
permissions:
contents: write
packages: write
strategy:
matrix:
args:
- context: ./packages/archive
image: ghcr.io/unkhz/ruuvipuserrin-archive
uses: ./.github/workflows/build-package.yml
with:
context: ${{ matrix.args.context }}
image: ${{ matrix.args.image }}
update-version-tags:
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
needs: build-package-images
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install yq
uses: mikefarah/yq@master
with:
cmd: yq --version
- name: Update version tags
run: |
function update_version_tag() {
file=$1
yq e '.images[0].newTag = "${{ github.sha }}"' -i $file
git add $file
}
update_version_tag ./packages/base-node/.khz-k3s/kustomization.yaml
update_version_tag ./packages/archive/.khz-k3s/kustomization.yaml
git config --global user.email "juhani.pelli@gmail.com"
git config --global user.name "Juhani Pelli"
git commit -m "Deploy ${{ github.sha }} [skip ci]"
git push origin ${{ github.event.repository.default_branch }}