-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (70 loc) · 2.08 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: main branch
on:
push:
branches: [ main ]
paths:
- '.github/**'
- 'api/**'
- 'cmd/**'
- 'deployments/**'
- 'internal/**'
- 'pkg/**'
- 'scripts/**'
- 'go.*'
- 'Dockerfile'
jobs:
version:
runs-on: ubuntu-latest
container: mpdred/semantic-tagger:latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 50
- name: Set the version number
run: |
git config --global user.email "[email protected]"
git config --global user.name "ci"
semtag -increment=auto -git-tag -push
semtag | tail -1 > .version.txt
- name: Upload the version file
uses: actions/upload-artifact@v3
with:
name: version-file
path: .version.txt
retention-days: 1
build:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- uses: actions/checkout@v3
- name: Download the version file
uses: actions/download-artifact@v3
with:
name: version-file
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create env file
run: |
touch .env
echo "DOCKERHUB_ORG=welthee" >> .env
echo "DOCKERHUB_REPO=dinonce" >> .env
echo "VERSION=$(cat .version.txt)" >> .env
cat .env
- name: Dotenv Action
id: dotenv
uses: falti/[email protected]
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: |
${{ steps.dotenv.outputs.dockerhub_org }}/${{ steps.dotenv.outputs.dockerhub_repo }}:${{ steps.dotenv.outputs.version }}
${{ steps.dotenv.outputs.dockerhub_org }}/${{ steps.dotenv.outputs.dockerhub_repo }}:latest