Skip to content

Commit 33cefea

Browse files
committed
Run docker build and update version tags
1 parent ea9f859 commit 33cefea

File tree

2 files changed

+28
-47
lines changed

2 files changed

+28
-47
lines changed

.github/workflows/build-package.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,20 @@ name: Build package
33
on:
44
workflow_call:
55
inputs:
6-
package:
7-
required: true
8-
type: string
96
context:
107
required: true
118
type: string
129
image:
1310
required: true
1411
type: string
15-
kustomization:
16-
required: true
17-
type: string
1812

1913
jobs:
2014
build:
2115
runs-on: ubuntu-latest
22-
continue-on-error: true
23-
24-
strategy:
25-
matrix:
26-
node-version: [20]
27-
2816
steps:
2917
- name: Checkout repository
3018
uses: actions/checkout@v4
3119

32-
- name: Setup node 20
33-
uses: actions/setup-node@v4
34-
with:
35-
node-version: ${{ matrix.node-version }}
36-
cache: 'npm'
37-
38-
- name: Run npm install
39-
run: npm install
40-
41-
- name: Run node build
42-
run: npx nx run-many --projects=${{ inputs.package }} --target=$node:build --output-style=stream
43-
4420
- name: Set up Docker Buildx
4521
uses: docker/setup-buildx-action@v2
4622

@@ -57,16 +33,3 @@ jobs:
5733
context: ${{ inputs.context }}
5834
push: true
5935
tags: ${{ inputs.image }}:latest, ${{ inputs.image }}:${{ github.sha }}
60-
61-
- uses: mikefarah/yq@master
62-
with:
63-
cmd: yq --version
64-
65-
- name: Update image version tag
66-
run: |
67-
git config --global user.email "juhani.pelli@gmail.com"
68-
git config --global user.name "Juhani Pelli"
69-
yq e '.images[0].newTag = "${{ github.sha }}"' -i ${{ inputs.kustomization }}
70-
git add ${{ inputs.kustomization }}
71-
git commit -m "Deploy ${{ github.sha }} [skip ci]"
72-
git push origin ${{ github.event.repository.default_branch }}

.github/workflows/master.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,13 @@ jobs:
5151
strategy:
5252
matrix:
5353
args:
54-
- package: base-node
55-
context: .
54+
- context: .
5655
image: ghcr.io/unkhz/ruuvipuserrin-base-node
57-
kustomization: ./packages/base-node/.khz-k3s/kustomization.yaml
5856

5957
uses: ./.github/workflows/build-package.yml
6058
with:
61-
package: ${{ matrix.args.package }}
6259
context: ${{ matrix.args.context }}
6360
image: ${{ matrix.args.image }}
64-
kustomization: ${{ matrix.args.kustomization }}
6561

6662
build-package-images:
6763
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }}
@@ -73,14 +69,36 @@ jobs:
7369
strategy:
7470
matrix:
7571
args:
76-
- package: archive
77-
context: ./packages/archive
72+
- context: ./packages/archive
7873
image: ghcr.io/unkhz/ruuvipuserrin-archive
79-
kustomization: ./packages/archive/.khz-k3s/kustomization.yaml
8074

8175
uses: ./.github/workflows/build-package.yml
8276
with:
83-
package: ${{ matrix.args.package }}
8477
context: ${{ matrix.args.context }}
8578
image: ${{ matrix.args.image }}
86-
kustomization: ${{ matrix.args.kustomization }}
79+
80+
update-version-tags:
81+
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }}
82+
runs-on: ubuntu-latest
83+
needs: build-package-images
84+
85+
strategy:
86+
matrix:
87+
kustomization:
88+
- ./packages/base-node/.khz-k3s/kustomization.yaml
89+
- ./packages/archive/.khz-k3s/kustomization.yaml
90+
91+
steps:
92+
- name: Install yq
93+
uses: mikefarah/yq@master
94+
with:
95+
cmd: yq --version
96+
97+
- name: Update image version tag
98+
run: |
99+
git config --global user.email "juhani.pelli@gmail.com"
100+
git config --global user.name "Juhani Pelli"
101+
yq e '.images[0].newTag = "${{ github.sha }}"' -i ${{ matrix.kustomization }}
102+
git add ${{ matrix.kustomization }}
103+
git commit -m "Deploy ${{ github.sha }} [skip ci]"
104+
git push origin ${{ github.event.repository.default_branch }}

0 commit comments

Comments
 (0)