-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (71 loc) · 2.51 KB
/
dev-build.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
name: Development Build
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
jobs:
dev-build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Extract Version for Dev Build
id: versioning
run: |
branch_name=${{ github.head_ref }}
if [[ "$branch_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
version=${branch_name#v}
echo "version=$version" >> $GITHUB_OUTPUT
echo "ghcr_tag=ghcr.io/thunderatz/stm32cubemx:${version}-dev" >> $GITHUB_OUTPUT
else
echo "Error: Branch name must follow 'vx.y.z' pattern." >&2
exit 1
fi
shell: bash
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Dev Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}
cache-to: type=inline
- name: Build and Push Dev Docker Image for G4 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=G4
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-g4
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-g4
cache-to: type=inline
- name: Build and Push Dev Docker Image for F4 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=F4
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-f4
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-f4
cache-to: type=inline
- name: Build and Push Dev Docker Image for F1 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=F1
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-f1
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-f1
cache-to: type=inline