-
Notifications
You must be signed in to change notification settings - Fork 2
121 lines (103 loc) · 3.7 KB
/
Copy pathrelease.yml
File metadata and controls
121 lines (103 loc) · 3.7 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Release
on:
release:
types: [published]
env:
REGISTRY: ghcr.io
REPOSITORY: ${{ github.repository }}
IMAGES: >-
[{
'name': 'radar-rest-source-auth-backend',
'build_file': 'authorizer-app-backend/Dockerfile',
'authors': 'Pauline Conde <pauline.conde@kcl.ac.uk>, Pim van Nierop <pim@thehyve.nl>',
'description': 'RADAR-base rest sources authorizer backend application',
'cache_keys_files': ['authorizer-app-backend/Dockerfile', '**/*.gradle.kts', 'gradle.properties', 'authorizer-app-backend/src/main/**']
},{
'name': 'radar-rest-source-authorizer',
'build_file': 'authorizer-app/Dockerfile',
'authors': 'Peyman Mohtashami <peyman@thehyve.nl>, Pauline Conde <pauline.conde@kcl.ac.uk>',
'description': 'RADAR-base rest sources authorizer frontend application',
'cache_keys_files': ['authorizer-app/**']
}]
jobs:
upload:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Compile code
run: ./gradlew :authorizer-app-backend:distTar :authorizer-app-backend:distZip
- name: Upload to GitHub
uses: AButler/upload-release-assets@v3.0
with:
files: 'authorizer-app-backend/build/distributions/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
prepare-matrix:
name: Prepare Matrix Output
runs-on: ubuntu-latest
permissions: {}
outputs:
images: ${{ steps.step1.outputs.matrix }}
steps:
- name: Create Matrix Variable
id: step1
run: echo "matrix=${{ env.IMAGES }}" >> $GITHUB_OUTPUT
docker:
needs: prepare-matrix
runs-on: ubuntu-latest
strategy:
matrix:
image: ${{ fromJson(needs.prepare-matrix.outputs.images ) }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5
# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase image name
run: |
echo "DOCKER_IMAGE=${REGISTRY}/${REPOSITORY,,}/${{ matrix.image.name }}" >>${GITHUB_ENV}
# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=match,pattern=v(.*),group=1
- name: Build backend docker and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.image.build_file }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=${{ matrix.image.authors }}
org.opencontainers.image.description=${{ matrix.image.description }}
org.opencontainers.image.authors=${{ matrix.image.authors }}
org.opencontainers.image.vendor=RADAR-base
org.opencontainers.image.licenses=Apache-2.0
- name: Inspect docker image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}