Skip to content

Commit 34d27a9

Browse files
nanotaboadaclaude
andcommitted
chore(ci): normalize and align CD pipeline (#314)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3a77647 commit 34d27a9

1 file changed

Lines changed: 26 additions & 15 deletions

File tree

.github/workflows/maven-cd.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
permissions:
3737
contents: write
3838
packages: write
39+
id-token: write
3940

4041
steps:
4142
- name: Checkout repository
@@ -87,34 +88,42 @@ jobs:
8788
- name: Set up Docker Buildx
8889
uses: docker/setup-buildx-action@v4.0.0
8990

90-
- name: Set image name
91-
id: image
92-
run: echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
93-
9491
- name: Build and push Docker image to GitHub Container Registry
92+
id: push
9593
uses: docker/build-push-action@v7.1.0
9694
with:
9795
context: .
9896
push: true
9997
platforms: linux/amd64,linux/arm64
100-
provenance: false
98+
provenance: mode=max
10199
cache-from: type=gha
102100
cache-to: type=gha,mode=max
103101
tags: |
104-
ghcr.io/${{ steps.image.outputs.name }}:latest
105-
ghcr.io/${{ steps.image.outputs.name }}:${{ steps.tag.outputs.semver }}
106-
ghcr.io/${{ steps.image.outputs.name }}:${{ steps.tag.outputs.club }}
102+
ghcr.io/${{ github.repository }}:latest
103+
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
104+
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.club }}
105+
106+
- name: Attest build provenance
107+
uses: actions/attest-build-provenance@v2
108+
with:
109+
subject-name: ghcr.io/${{ github.repository }}
110+
subject-digest: ${{ steps.push.outputs.digest }}
107111

108112
- name: Generate changelog
109113
id: changelog
110114
run: |
111115
CURRENT_TAG="${GITHUB_REF#refs/tags/}"
112116
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -Fxv "$CURRENT_TAG" | head -n 1)
113117
if [ -n "$PREVIOUS_TAG" ]; then
114-
CHANGELOG=$(git log "$PREVIOUS_TAG"..HEAD --pretty=format:"- %s" --no-merges)
118+
CHANGELOG=$(git log "$PREVIOUS_TAG"..HEAD --pretty=format:"- %s (%h)" --no-merges)
115119
else
116-
CHANGELOG=$(git log --pretty=format:"- %s" --no-merges)
120+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
117121
fi
122+
123+
if [ -z "$CHANGELOG" ]; then
124+
CHANGELOG="No new changes since $PREVIOUS_TAG"
125+
fi
126+
118127
{
119128
echo "content<<EOF"
120129
echo "$CHANGELOG"
@@ -134,20 +143,22 @@ jobs:
134143
135144
```bash
136145
# By semantic version (recommended)
137-
docker pull ghcr.io/${{ steps.image.outputs.name }}:${{ steps.tag.outputs.semver }}
146+
docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
138147
139148
# By club name
140-
docker pull ghcr.io/${{ steps.image.outputs.name }}:${{ steps.tag.outputs.club }}
149+
docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.club }}
141150
142151
# Latest
143-
docker pull ghcr.io/${{ steps.image.outputs.name }}:latest
152+
docker pull ghcr.io/${{ github.repository }}:latest
144153
```
145154
146155
## Quick Start
147156
148157
```bash
149-
docker run -p 9000:9000 ghcr.io/${{ steps.image.outputs.name }}:${{ steps.tag.outputs.semver }}
158+
docker run -p 9000:9000 ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.semver }}
150159
```
151160
152161
API available at `http://localhost:9000` · Swagger UI at `http://localhost:9000/swagger/index.html`
153-
generate_release_notes: false
162+
draft: false
163+
prerelease: false
164+
generate_release_notes: true

0 commit comments

Comments
 (0)