-
Notifications
You must be signed in to change notification settings - Fork 78
87 lines (75 loc) · 2.21 KB
/
build-and-push.yaml
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
86
87
# Builds and pushes docker images on main and tags
name: Build and Push Docker images
on:
push:
branches:
- main
- "release/**"
- "docker/**"
paths:
- "Makefile"
- "pom.xml"
- ".github/workflows/build-and-push.yaml"
- "config"
- "src/**"
tags:
- '*'
jobs:
build:
if: github.repository == 'geoserver/geoserver-cloud'
name: Build and Push
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install Cosign
uses: sigstore/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Add support for more platforms with QEMU
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# https://github.com/docker/setup-buildx-action
with:
platforms: linux/amd64,linux/arm64
# Sets up docker build command as an alias to docker buildx
install: true
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Build without tests
run: |
make install
- name: Build and push images
run: |
COMPOSE_BUILD_ARGS=--push make build-image
- name: Remove project jars from cached repository
run: |
rm -rf ~/.m2/repository/org/geoserver
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: Sign images
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
COSIGN_KEY: ${{ secrets.COSIGN_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: |
make sign-image
- name: Verify image signatures
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
COSIGN_PUB_KEY: ${{ secrets.COSIGN_PUB_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: |
make verify-image