Skip to content

Commit 0ce22fb

Browse files
authored
Merge pull request #321 from nanotaboada/dependabot/github_actions/softprops/action-gh-release-3.0.0
chore(deps): bump softprops/action-gh-release from 2.6.1 to 3.0.0
2 parents efba5b7 + fa237d2 commit 0ce22fb

File tree

1 file changed

+153
-153
lines changed

1 file changed

+153
-153
lines changed

.github/workflows/maven-cd.yml

Lines changed: 153 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -4,160 +4,160 @@
44
name: Java CD
55

66
on:
7-
push:
8-
tags:
9-
- "v*.*.*-*"
7+
push:
8+
tags:
9+
- "v*.*.*-*"
1010

1111
env:
12-
JAVA_VERSION: 25
12+
JAVA_VERSION: 25
1313

1414
jobs:
15-
test:
16-
runs-on: ubuntu-latest
17-
permissions:
18-
contents: read
19-
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v6
22-
23-
- name: Set up OpenJDK ${{ env.JAVA_VERSION }}
24-
uses: actions/setup-java@v5.2.0
25-
with:
26-
java-version: ${{ env.JAVA_VERSION }}
27-
distribution: "temurin"
28-
cache: "maven"
29-
30-
- name: Compile and verify with Maven
31-
run: ./mvnw clean verify
32-
33-
release:
34-
needs: test
35-
runs-on: ubuntu-latest
36-
permissions:
37-
contents: write
38-
packages: write
39-
id-token: write
40-
attestations: write
41-
42-
steps:
43-
- name: Checkout repository
44-
uses: actions/checkout@v6
45-
with:
46-
fetch-depth: 0
47-
48-
- name: Verify tag commit is reachable from master
49-
run: |
50-
if ! git merge-base --is-ancestor "${{ github.sha }}" origin/master; then
51-
echo "❌ Tag commit ${{ github.sha }} is not reachable from origin/master"
52-
exit 1
53-
fi
54-
echo "✅ Tag commit ${{ github.sha }} is reachable from origin/master"
55-
56-
- name: Extract and validate tag components
57-
id: tag
58-
run: |
59-
TAG="${GITHUB_REF#refs/tags/}"
60-
echo "Full tag: $TAG"
61-
62-
SEMVER=$(echo "$TAG" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+)-.+$/\1/')
63-
CLUB=$(echo "$TAG" | sed -E 's/^v[0-9]+\.[0-9]+\.[0-9]+-(.+)$/\1/')
64-
65-
VALID_CLUBS="arsenal barcelona chelsea dortmund everton flamengo galatasaray hamburg inter juventus kaiserslautern liverpool manchesterutd napoli olympique psg qpr realmadrid sevilla tottenham union valencia werder xerez youngboys zenit"
66-
67-
if ! echo "$SEMVER" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
68-
echo "❌ Invalid semver: $SEMVER"
69-
exit 1
70-
fi
71-
72-
if ! echo "$VALID_CLUBS" | grep -qw "$CLUB"; then
73-
echo "❌ Invalid club name: $CLUB"
74-
echo "Valid clubs: $VALID_CLUBS"
75-
exit 1
76-
fi
77-
78-
echo "semver=$SEMVER" >> "$GITHUB_OUTPUT"
79-
echo "club=$CLUB" >> "$GITHUB_OUTPUT"
80-
echo "✅ Tag: v$SEMVER - $CLUB"
81-
82-
- name: Log in to GitHub Container Registry
83-
uses: docker/login-action@v4.1.0
84-
with:
85-
registry: ghcr.io
86-
username: ${{ github.actor }}
87-
password: ${{ secrets.GITHUB_TOKEN }}
88-
89-
- name: Set up Docker Buildx
90-
uses: docker/setup-buildx-action@v4.0.0
91-
92-
- name: Build and push Docker image to GitHub Container Registry
93-
id: push
94-
uses: docker/build-push-action@v7.1.0
95-
with:
96-
context: .
97-
push: true
98-
platforms: linux/amd64,linux/arm64
99-
provenance: mode=max
100-
cache-from: type=gha
101-
cache-to: type=gha,mode=max
102-
tags: |
103-
ghcr.io/${{ github.repository }}:latest
104-
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
105-
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.club }}
106-
107-
- name: Attest build provenance
108-
uses: actions/attest-build-provenance@v4.1.0
109-
with:
110-
subject-name: ghcr.io/${{ github.repository }}
111-
subject-digest: ${{ steps.push.outputs.digest }}
112-
push-to-registry: true
113-
114-
- name: Generate changelog
115-
id: changelog
116-
run: |
117-
CURRENT_TAG="${GITHUB_REF#refs/tags/}"
118-
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -Fxv "$CURRENT_TAG" | head -n 1)
119-
if [ -n "$PREVIOUS_TAG" ]; then
120-
CHANGELOG=$(git log "$PREVIOUS_TAG"..HEAD --pretty=format:"- %s (%h)" --no-merges)
121-
else
122-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
123-
fi
124-
125-
if [ -z "$CHANGELOG" ]; then
126-
if [ -n "$PREVIOUS_TAG" ]; then
127-
CHANGELOG="No new changes since $PREVIOUS_TAG"
128-
else
129-
CHANGELOG="No changes (first release)"
130-
fi
131-
fi
132-
133-
{
134-
echo "content<<EOF"
135-
echo "$CHANGELOG"
136-
echo "EOF"
137-
} >> "$GITHUB_OUTPUT"
138-
139-
- name: Create GitHub Release
140-
uses: softprops/action-gh-release@v2.6.1
141-
with:
142-
name: "v${{ steps.tag.outputs.semver }} - ${{ steps.tag.outputs.club }} 🏆"
143-
body: |
144-
## What's Changed
145-
146-
${{ steps.changelog.outputs.content }}
147-
148-
## Docker
149-
150-
```bash
151-
# By semantic version (recommended)
152-
docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
153-
154-
# By club name
155-
docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.club }}
156-
157-
# Latest
158-
docker pull ghcr.io/${{ github.repository }}:latest
159-
```
160-
161-
draft: false
162-
prerelease: false
163-
generate_release_notes: true
15+
test:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v6.0.2
22+
23+
- name: Set up OpenJDK ${{ env.JAVA_VERSION }}
24+
uses: actions/setup-java@v5.2.0
25+
with:
26+
java-version: ${{ env.JAVA_VERSION }}
27+
distribution: "temurin"
28+
cache: "maven"
29+
30+
- name: Compile and verify with Maven
31+
run: ./mvnw clean verify
32+
33+
release:
34+
needs: test
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
packages: write
39+
id-token: write
40+
attestations: write
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v6.0.2
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Verify tag commit is reachable from master
49+
run: |
50+
if ! git merge-base --is-ancestor "${{ github.sha }}" origin/master; then
51+
echo "❌ Tag commit ${{ github.sha }} is not reachable from origin/master"
52+
exit 1
53+
fi
54+
echo "✅ Tag commit ${{ github.sha }} is reachable from origin/master"
55+
56+
- name: Extract and validate tag components
57+
id: tag
58+
run: |
59+
TAG="${GITHUB_REF#refs/tags/}"
60+
echo "Full tag: $TAG"
61+
62+
SEMVER=$(echo "$TAG" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+)-.+$/\1/')
63+
CLUB=$(echo "$TAG" | sed -E 's/^v[0-9]+\.[0-9]+\.[0-9]+-(.+)$/\1/')
64+
65+
VALID_CLUBS="arsenal barcelona chelsea dortmund everton flamengo galatasaray hamburg inter juventus kaiserslautern liverpool manchesterutd napoli olympique psg qpr realmadrid sevilla tottenham union valencia werder xerez youngboys zenit"
66+
67+
if ! echo "$SEMVER" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
68+
echo "❌ Invalid semver: $SEMVER"
69+
exit 1
70+
fi
71+
72+
if ! echo "$VALID_CLUBS" | grep -qw "$CLUB"; then
73+
echo "❌ Invalid club name: $CLUB"
74+
echo "Valid clubs: $VALID_CLUBS"
75+
exit 1
76+
fi
77+
78+
echo "semver=$SEMVER" >> "$GITHUB_OUTPUT"
79+
echo "club=$CLUB" >> "$GITHUB_OUTPUT"
80+
echo "✅ Tag: v$SEMVER - $CLUB"
81+
82+
- name: Log in to GitHub Container Registry
83+
uses: docker/login-action@v4.1.0
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.actor }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v4.0.0
91+
92+
- name: Build and push Docker image to GitHub Container Registry
93+
id: push
94+
uses: docker/build-push-action@v7.1.0
95+
with:
96+
context: .
97+
push: true
98+
platforms: linux/amd64,linux/arm64
99+
provenance: mode=max
100+
cache-from: type=gha
101+
cache-to: type=gha,mode=max
102+
tags: |
103+
ghcr.io/${{ github.repository }}:latest
104+
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
105+
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.club }}
106+
107+
- name: Attest build provenance
108+
uses: actions/attest-build-provenance@v4.1.0
109+
with:
110+
subject-name: ghcr.io/${{ github.repository }}
111+
subject-digest: ${{ steps.push.outputs.digest }}
112+
push-to-registry: true
113+
114+
- name: Generate changelog
115+
id: changelog
116+
run: |
117+
CURRENT_TAG="${GITHUB_REF#refs/tags/}"
118+
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -Fxv "$CURRENT_TAG" | head -n 1)
119+
if [ -n "$PREVIOUS_TAG" ]; then
120+
CHANGELOG=$(git log "$PREVIOUS_TAG"..HEAD --pretty=format:"- %s (%h)" --no-merges)
121+
else
122+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
123+
fi
124+
125+
if [ -z "$CHANGELOG" ]; then
126+
if [ -n "$PREVIOUS_TAG" ]; then
127+
CHANGELOG="No new changes since $PREVIOUS_TAG"
128+
else
129+
CHANGELOG="No changes (first release)"
130+
fi
131+
fi
132+
133+
{
134+
echo "content<<EOF"
135+
echo "$CHANGELOG"
136+
echo "EOF"
137+
} >> "$GITHUB_OUTPUT"
138+
139+
- name: Create GitHub Release
140+
uses: softprops/action-gh-release@v3.0.0
141+
with:
142+
name: "v${{ steps.tag.outputs.semver }} - ${{ steps.tag.outputs.club }} 🏆"
143+
body: |
144+
## What's Changed
145+
146+
${{ steps.changelog.outputs.content }}
147+
148+
## Docker
149+
150+
```bash
151+
# By semantic version (recommended)
152+
docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
153+
154+
# By club name
155+
docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.club }}
156+
157+
# Latest
158+
docker pull ghcr.io/${{ github.repository }}:latest
159+
```
160+
161+
draft: false
162+
prerelease: false
163+
generate_release_notes: true

0 commit comments

Comments
 (0)