-
Notifications
You must be signed in to change notification settings - Fork 10
85 lines (80 loc) · 2.58 KB
/
workflow.yml
File metadata and controls
85 lines (80 loc) · 2.58 KB
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
name: workflow
on:
push:
tags:
- '*.*.*'
branches:
- '**'
merge_group:
pull_request:
branches:
- main
env:
CI: true
jobs:
build-ng:
runs-on: ubuntu-latest
env:
TZ: Europe/Amsterdam
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm ci --ignore-scripts --legacy-peer-deps
- run: npm run test
build-rs:
runs-on: ubuntu-latest
env:
TZ: Europe/Amsterdam
defaults:
run:
working-directory: ./api
steps:
- uses: actions/checkout@v6
- run: cargo build --verbose
- run: cargo test --verbose
- run: cargo clippy --verbose -- -D warnings
build-docker:
if: github.event_name != 'pull_request'
needs: [build-rs, build-ng]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: |
REF_NAME="${{ github.ref_name }}"
REF_NAME_LOWER=$(echo "$REF_NAME" | tr '[:upper:]' '[:lower:]')
REF_NAME_CLEAN=$(echo "$REF_NAME_LOWER" | tr -cd '[:alnum:]._-')
REF_NAME_CLEAN=$(echo "$REF_NAME_CLEAN" | sed 's/^[^a-z0-9]*//;s/[^a-z0-9]*$//')
if [[ ! "$REF_NAME_CLEAN" =~ ^[a-z0-9] ]]; then
REF_NAME_CLEAN="0$REF_NAME_CLEAN"
fi
echo "CLEANED_REF_NAME=$REF_NAME_CLEAN" >> $GITHUB_ENV
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: peter-evans/dockerhub-description@v5
if: github.ref == 'refs/heads/main'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ github.repository }}
short-description: ${{ github.event.repository.description }}
- uses: docker/build-push-action@v7
if: startsWith(github.ref, 'refs/tags/')
with:
context: .
push: true
tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ github.ref_name }}
build-args: VERSION_ARG=v${{ github.ref_name }}
- uses: docker/build-push-action@v7
if: startsWith(github.ref, 'refs/heads/')
with:
context: .
push: true
tags: ${{ github.repository }}:${{ env.CLEANED_REF_NAME }}
build-args: VERSION_ARG=${{ github.sha }}@${{ env.CLEANED_REF_NAME }}