-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.49 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
name: Development Build
on:
pull_request:
paths-ignore:
- ".vscode/**"
- ".devcontainer/**"
- "assets/**"
- "docs/**"
- ".editorconfig"
- "**.md"
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 "tags=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.tags }}
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}
cache-to: type=inline