Skip to content

Commit 0bbc814

Browse files
authored
Support pre-releases with version suffix (#529)
1 parent 03309d9 commit 0bbc814

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/release.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ jobs:
1515
- name: Get tag
1616
id: vars
1717
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
18+
- name: Validate version number
19+
run: >-
20+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
21+
if ! [[ "${{ steps.vars.outputs.tag }}" =~ "b" ]]; then
22+
echo "Pre-release: Tag is missing beta suffix (${{ steps.vars.outputs.tag }})"
23+
exit 1
24+
fi
25+
else
26+
if [[ "${{ steps.vars.outputs.tag }}" =~ "b" ]]; then
27+
echo "Release: Tag must not have a beta suffix (${{ steps.vars.outputs.tag }})"
28+
exit 1
29+
fi
30+
fi
1831
- name: Set up Python 3.10
1932
uses: actions/setup-python@v5.0.0
2033
with:
@@ -67,8 +80,9 @@ jobs:
6780
echo "patch=${patch}" >> $GITHUB_OUTPUT
6881
echo "minor=${patch%.*}" >> $GITHUB_OUTPUT
6982
echo "major=${patch%.*.*}" >> $GITHUB_OUTPUT
70-
- name: Build and Push
83+
- name: Build and Push release
7184
uses: docker/build-push-action@v5.1.0
85+
if: github.event.release.prerelease == false
7286
with:
7387
context: .
7488
platforms: linux/amd64,linux/arm64
@@ -81,3 +95,16 @@ jobs:
8195
push: true
8296
build-args:
8397
"PYTHON_MATTER_SERVER=${{ needs.build-and-publish-pypi.outputs.version }}"
98+
- name: Build and Push pre-release
99+
uses: docker/build-push-action@v5.1.0
100+
if: github.event.release.prerelease == true
101+
with:
102+
context: .
103+
platforms: linux/amd64,linux/arm64
104+
file: Dockerfile
105+
tags: |-
106+
ghcr.io/${{ github.repository_owner }}/python-matter-server:${{ steps.tags.outputs.patch }},
107+
ghcr.io/${{ github.repository_owner }}/python-matter-server:beta
108+
push: true
109+
build-args:
110+
"PYTHON_MATTER_SERVER=${{ needs.build-and-publish-pypi.outputs.version }}"

0 commit comments

Comments
 (0)