-
Notifications
You must be signed in to change notification settings - Fork 68
69 lines (67 loc) · 2.25 KB
/
main.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
on: push
env:
IMAGE: ${{ secrets.DOCKER_HUB_USERNAME }}/sdr-scanner
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up docker cache
uses: actions/cache@v3
with:
path: cache
key: docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Generate version file
run: |
echo "constexpr auto GIT_COMMIT = \"${{ github.sha }}\";" > sources/version.h
echo "constexpr auto GIT_TAG = \"${{ github.ref_name }}\";" >> sources/version.h
- name: Build test
uses: docker/build-push-action@v5
with:
context: .
load: true
target: test
tags: ${{ env.IMAGE }}:test
cache-from: type=local,src=cache
cache-to: type=local,dest=cache,mode=max
- name: Build app
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=local,src=cache
cache-to: type=local,dest=cache,mode=max
- name: Run test
run: |
docker run --rm ${{ env.IMAGE }}:test
- name: Push development version
if: ${{ github.ref_type == 'branch' && github.ref_name == vars.CI_BRANCH }}
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
tags: ${{ env.IMAGE }}:${{ github.ref_name }}
cache-from: type=local,src=cache
cache-to: type=local,dest=cache,mode=max
- name: Push release version
if: ${{ github.ref_type == 'tag' }}
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
tags: |
${{ env.IMAGE }}:latest
${{ env.IMAGE }}:${{ github.ref_name }}
cache-from: type=local,src=cache
cache-to: type=local,dest=cache,mode=max