-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 1.69 KB
/
Copy pathpublish.yml
File metadata and controls
59 lines (52 loc) · 1.69 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
name: Publish Controller
on:
push:
branches:
- 'master'
workflow_dispatch:
inputs:
base_version:
description: 'Base version like v1.0.0 (used when running manually)'
required: false
default: 'v0.0.0'
permissions:
contents: read
packages: write
jobs:
publish:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Read version (input > pom)
id: ver
run: |
if [[ -n "${{ github.event.inputs.base_version }}" ]]; then
VERSION="${{ github.event.inputs.base_version }}"
else
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Build and Publish to GitHub Packages
env:
VERSION: ${{ steps.ver.outputs.version }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn versions:set -DnewVersion=${VERSION} -DgenerateBackupPoms=false
mvn clean deploy -DskipTests -B \
-Dregistry=https://maven.pkg.github.com/${{ github.repository_owner }}/$(basename ${{ github.repository }}) \
-Dtoken=${GITHUB_TOKEN}
- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: controller-${{ steps.ver.outputs.version }}
path: target/*-${{ steps.ver.outputs.version }}.jar