-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (94 loc) · 3.13 KB
/
release.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
88
89
90
91
92
93
94
95
96
97
name: release
# Run workflow on commits to the `main` branch
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to release from ?"
required: true
default: "main"
release-version:
description: "Release version ?"
required: true
release-tag:
description: "Release tag ?"
required: true
development-version:
description: "Development version ?"
required: true
latest-image:
description: "Tag image as 'latest' (y/n) ?"
required: true
default: "y"
jobs:
prepare-release:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Setup git user
uses: fregante/setup-git-user@v2
- name: Install Java and Maven
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
- name: Perform maven release
run: >
mvn -B -ntp release:prepare
-DreleaseVersion=${{ github.event.inputs.release-version }}
-DdevelopmentVersion=${{ github.event.inputs.development-version }}
-Dtag=${{ github.event.inputs.release-tag }}
-Darguments="-DskipTests"
publish-image:
needs: prepare-release
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: checkout release tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.release-tag }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: docker.io/itatm/appswitcher-server
tags: |
type=raw,value=${{ github.event.inputs.release-version }}
${{ (github.event.inputs.latest-image == 'y' && 'type=raw,value=latest') || '' }}
- name: Build with Maven
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
IMAGE_RAW_TAGS: ${{ steps.meta.outputs.tags }}
REGISTRY_USER: ${{ github.repository_owner }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST_TAG: ${{ (github.event.inputs.latest-image == 'y' && 'y') || 'n' }}
run: |
export IMAGE_TAGS="${IMAGE_RAW_TAGS//$'\n'/,}"
if [[ $LATEST_TAG == "y" ]]; then export IMAGE_TAGS=$IMAGE_TAGS,ghcr.io/it-at-m/appswitcher-server:latest; fi
mvn -B -ntp -P build-image,publish verify
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
files: |
target/*.jar
tag_name: ${{ github.event.inputs.release-tag }}
draft: false
prerelease: false
generate_release_notes: true