forked from GeoNode/geonode
-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (79 loc) · 2.73 KB
/
52n-release.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: Release GeoNode Docker Images
concurrency:
group: "geonode_build_release"
cancel-in-progress: true
env:
TITLE: "52°North GeoNode Docker Image"
VENDOR: "52°North GmbH"
AUTHORS: "https://52North.org/"
DESCRIPTION: "Builds and publishes the Docker images GeoNode, GeoServer, Nginx"
LICENSE: "GPL-3.0"
on:
push:
tags:
- "*-52n"
jobs:
build_and_push_geonode:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: "${{github.ref_name}}"
version_extractor_regex: '(.*)-52n'
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
env:
MAJOR_VERSION: ${{ steps.semver_parser.outputs.major }}
MAJOR_MINOR_VERSION: ${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}
MAJOR_MINOR_PATCH_VERSION: ${{ steps.semver_parser.outputs.fullversion }}
with:
images: ${{ env.IMAGE }}
labels: |
"org.opencontainers.image.authors=${{ env.AUTHORS }}"
"org.opencontainers.image.vendor=${{ env.VENDOR }}"
"org.opencontainers.image.description=${{ env.DESCRIPTION }}"
"org.opencontainers.image.title=${{ env.TITLE }}"
"org.opencontainers.image.licenses=${{ env.LICENSE }}"
tags: |
latest
${{ env.MAJOR_VERSION }}
${{ env.MAJOR_MINOR_VERSION }}
${{ env.MAJOR_MINOR_PATCH_VERSION }}
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN_52N_MASTER }}
-
name: Fail in case fully tagged version already exists
run: |
if docker manifest inspect ${{ env.IMAGE }}:${{ steps.semver_parser.outputs.fullversion }}; then
echo "tag version already exists! Will not override."
exit 1
fi
-
name: Build and push
if: ${{ !github.event.act }} # skip during local actions testing
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max