1
1
name : Deploy Release Build
2
2
3
- # Trigger on release
3
+ # Trigger on new version tag
4
4
on :
5
- release :
6
- types :
7
- - released
5
+ push :
6
+ tags :
7
+ - ' [0-9]+.[0-9]+.[0-9]+* '
8
8
9
9
jobs :
10
+ # get_latest_version:
11
+ # uses: ./.github/workflows/get_nexus_version_latest.yml
12
+
10
13
build_deploy_to_registry :
11
14
runs-on : ubuntu-latest
15
+ # needs: get_latest_version
12
16
steps :
13
17
- name : Checkout
14
- uses : actions/checkout@v2
18
+ uses : actions/checkout@v4
15
19
16
20
# Enable docker cache to speed-up builds
17
21
- name : Setup Docker build cache
18
- uses : actions/cache@v2
22
+ uses : actions/cache@v3
19
23
with :
20
24
path : /tmp/buildx-cache
21
25
key : ${{runner.os}}-buildx-${{github.sha}}
@@ -24,40 +28,67 @@ jobs:
24
28
25
29
# Enable multi-architecture support on build node
26
30
- name : Set up QEMU
27
- uses : docker/setup-qemu-action@v1
31
+ uses : docker/setup-qemu-action@v3
28
32
with :
29
33
platforms : all
30
34
31
35
- name : Set up Docker Buildx
32
- uses : docker/setup-buildx-action@v1
36
+ uses : docker/setup-buildx-action@v3
33
37
with :
34
38
version : latest
35
39
36
40
- name : Docker login
37
- uses : docker/login-action@v1
41
+ uses : docker/login-action@v3
38
42
with :
39
43
username : ${{secrets.REGISTRY_USERNAME}}
40
44
password : ${{secrets.REGISTRY_PASSWORD}}
41
45
42
- - name : Build + Push image (tag = git release tag)
46
+ - name : Build + Push image (tag = git tag)
47
+ env :
48
+ # `github.ref_name` == git tag triggered build
49
+ NEXUS_VERSION : ${{github.ref_name}}
43
50
run : |
44
51
docker buildx build \
52
+ --build-arg "NEXUS_VERSION=${NEXUS_VERSION}" \
45
53
--cache-from type=local,src=/tmp/buildx-cache \
46
54
--cache-to type=local,dest=/tmp/buildx-cache \
47
55
--label org.opencontainers.image.revision="${{github.sha}}" \
56
+ --label org.opencontainers.image.version="${NEXUS_VERSION}" \
48
57
--platform "linux/arm/v7,linux/arm64" \
49
58
--pull \
50
- --tag "${{secrets.REGISTRY_USERNAME}}/nexus3:${GITHUB_REF#refs/tags/ }" \
59
+ --tag "${{secrets.REGISTRY_USERNAME}}/nexus3:${NEXUS_VERSION }" \
51
60
--output "type=image,push=true" \
52
61
--file ./Dockerfile .
53
62
54
63
- name : Build + Push image ("latest")
64
+ env :
65
+ # `github.ref_name` == git tag triggered build
66
+ NEXUS_VERSION : ${{github.ref_name}}
55
67
run : |
56
68
docker buildx build \
69
+ --build-arg "NEXUS_VERSION=${NEXUS_VERSION}" \
57
70
--cache-from type=local,src=/tmp/buildx-cache \
58
71
--cache-to type=local,dest=/tmp/buildx-cache \
59
72
--label org.opencontainers.image.revision="${{github.sha}}" \
73
+ --label org.opencontainers.image.version="${NEXUS_VERSION}" \
60
74
--platform "linux/arm/v7,linux/arm64" \
61
75
--tag "${{secrets.REGISTRY_USERNAME}}/nexus3:latest" \
62
76
--output "type=image,push=true" \
63
77
--file ./Dockerfile .
78
+
79
+ create_release :
80
+ runs-on : ubuntu-latest
81
+ permissions :
82
+ contents : write
83
+ needs : build_deploy_to_registry
84
+ steps :
85
+ - name : Create Github Release
86
+
87
+ with :
88
+ tag : ${{github.ref_name}}
89
+ name : ${{github.ref_name}}
90
+ body : (Automated release)
91
+ draft : false
92
+ prerelease : false
93
+ # Allow re-run workflow job
94
+ skipIfReleaseExists : true
0 commit comments