-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (76 loc) · 2.38 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (76 loc) · 2.38 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
on:
push:
branches: [ "release" ]
permissions:
contents: write
packages: write
id-token: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "liberica"
java-version: "21"
cache: gradle
- name: Compute next SemVer and tag
id: semver
uses: paulhatch/semantic-version@v5.4.0
with:
tag_prefix: "v"
major_pattern: "/!:|BREAKING CHANGE:/"
minor_pattern: "/feat(\\(.+\\))?:/"
version_format: "${major}.${minor}.${patch}"
- name: Create and push tag
run: |
VERSION="${{ steps.semver.outputs.version }}"
TAG="v${VERSION}"
# If tag already exists, do nothing
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists; skipping tag push."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Determine version to use
id: version
run: |
# Prefer tag-created version output; fallback to computed output
VERSION="${{ steps.semver.outputs.version }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Run tests
run: ./gradlew test
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ steps.version.outputs.version }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_VERSION=${{ steps.version.outputs.version }}