Skip to content

Commit 0e840c3

Browse files
authored
fix: release CI (#1391)
1 parent 617089f commit 0e840c3

1 file changed

Lines changed: 12 additions & 97 deletions

File tree

.github/workflows/on-release.yaml

Lines changed: 12 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -53,108 +53,23 @@ jobs:
5353
exit 1
5454
fi
5555
56-
# Split the job in 2. First one finds the relevant RC tag, and outputs it. The next job should be manually approved by the release team.
57-
find-and-pull-rc-image:
58-
name: Find and Pull RC Image
59-
runs-on: ubuntu-22.04
60-
permissions:
61-
contents: read
56+
publish-docker-image:
57+
name: Publish Docker Image
58+
uses: ./.github/workflows/publish-docker-images.yaml
59+
secrets: inherit
6260
needs:
6361
- validate
64-
outputs:
65-
rc_tag: ${{ steps.find-rc.outputs.latest_rc_tag }}
66-
steps:
67-
- name: Find Latest RC Tag
68-
id: find-rc
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71-
run: |
72-
echo "Release tag: ${{ github.ref_name }}"
73-
# Find all RC tags for this version and get the latest one
74-
latest_rc=$(gh api repos/${{github.repository}}/git/refs/tags \
75-
--jq '[.[]
76-
| select(.ref | test("refs/tags/${{ github.ref_name }}-rc.[0-9]+$"))
77-
| {ref, rc: (.ref | capture("rc\\.(?<num>[0-9]+)$").num | tonumber)}
78-
]
79-
| sort_by(.rc)
80-
| last
81-
| .ref')
82-
83-
# remove the "refs/tags/" prefix
84-
latest_rc="${latest_rc#refs/tags/}"
85-
86-
if [ -z "$latest_rc" ]; then
87-
echo "No RC tag found for ${{ github.ref_name }}"
88-
exit 1
89-
fi
90-
91-
echo "Latest RC tag: $latest_rc"
92-
echo "latest_rc_tag=$latest_rc" >> $GITHUB_OUTPUT
93-
94-
- name: Pull RC Image from Docker Hub
95-
run: |
96-
RC_TAG="${{ steps.find-rc.outputs.latest_rc_tag }}"
97-
REPO="${{ github.repository }}"
98-
99-
echo "Pulling RC image: $REPO:$RC_TAG"
100-
# Pull from Docker Hub (public, no login needed)
101-
docker pull $REPO:$RC_TAG
102-
103-
retag-and-publish-docker-image:
104-
name: Retag and Publish Docker Image
105-
runs-on: ubuntu-22.04
106-
needs:
107-
- find-and-pull-rc-image
10862
permissions:
10963
contents: read
11064
packages: write
111-
environment: docker-publish
112-
steps:
113-
- name: Log in to Docker Hub
114-
uses: docker/login-action@v3
115-
with:
116-
username: ${{ secrets.DOCKERHUB_USERNAME }}
117-
password: ${{ secrets.DOCKERHUB_TOKEN }}
118-
119-
- name: Log in to the Container registry
120-
uses: docker/login-action@v3
121-
with:
122-
registry: ghcr.io
123-
username: ${{ github.actor }}
124-
password: ${{ secrets.GITHUB_TOKEN }}
125-
126-
- name: Pull, Retag and Push Docker Images
127-
env:
128-
RC_TAG: ${{ needs.find-and-pull-rc-image.outputs.rc_tag }}
129-
RELEASE_TAG: ${{ github.ref_name }}
130-
REPO: ${{ github.repository }}
131-
run: |
132-
echo "Using RC tag: $RC_TAG"
133-
echo "Release tag: $RELEASE_TAG"
134-
135-
# Pull RC images from both registries
136-
docker pull $REPO:$RC_TAG
137-
docker pull ghcr.io/$REPO:$RC_TAG
138-
139-
echo "Retagging images for release: $RELEASE_TAG"
140-
141-
# Retag Docker Hub images
142-
docker tag $REPO:$RC_TAG $REPO:$RELEASE_TAG
143-
docker tag $REPO:$RC_TAG $REPO:latest
144-
145-
# Retag GHCR images
146-
docker tag ghcr.io/$REPO:$RC_TAG ghcr.io/$REPO:$RELEASE_TAG
147-
docker tag ghcr.io/$REPO:$RC_TAG ghcr.io/$REPO:latest
148-
149-
echo "Pushing retagged images"
150-
151-
# Push to Docker Hub
152-
docker push $REPO:$RELEASE_TAG
153-
docker push $REPO:latest
154-
155-
# Push to GHCR
156-
docker push ghcr.io/$REPO:$RELEASE_TAG
157-
docker push ghcr.io/$REPO:latest
65+
with:
66+
environment: docker-publish
67+
images: |
68+
${{ github.repository }}
69+
ghcr.io/${{ github.repository }}
70+
tags: |
71+
type=raw,value=${{ github.ref_name }}
72+
type=raw,value=latest
15873
15974
publish-binaries:
16075
name: Publish Binaries

0 commit comments

Comments
 (0)