Skip to content

Commit b299188

Browse files
authored
Add release workflow (#378)
1 parent c9a42d1 commit b299188

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v[0-9]+.[0-9]+.[0-9]+
6+
jobs:
7+
org-check:
8+
name: Check GitHub Organization
9+
if: ${{ github.repository_owner == 'korfuri' }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Noop
13+
run: "true"
14+
determine-tag:
15+
name: Determine the release tag to operate against.
16+
needs: org-check
17+
runs-on: ubuntu-latest
18+
outputs:
19+
release-tag: ${{ steps.determine-tag.outputs.release-tag }}
20+
release-version: ${{ steps.determine-tag.outputs.release-version }}
21+
steps:
22+
- name: Determine Tag
23+
id: determine-tag
24+
run: |
25+
RELEASE_TAG=${GITHUB_REF#refs/tags/}
26+
fi
27+
if [[ "${RELEASE_TAG}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]; then
28+
echo "release-tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
29+
echo "release-version=${RELEASE_TAG#v}" >> $GITHUB_OUTPUT
30+
else
31+
echo "::error::Release tag '${RELEASE_TAG}' must match 'v\d+.\d+.\d+'."
32+
exit 1
33+
fi
34+
release-django-prometheus-job:
35+
runs-on: ubuntu-latest
36+
name: Release Django-Promethues
37+
needs: determine-tag
38+
steps:
39+
- uses: actions/checkout@v3
40+
with:
41+
ref: ${{ needs.determine-tag.outputs.release-tag }}
42+
fetch-depth: 0
43+
- name: Set up Python 3.9
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: 3.9
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install wheel setuptools packaging twine build --upgrade
51+
- name: Build
52+
run: python -m build
53+
- name: Publish to TEST PyPI
54+
uses: pypa/gh-action-pypi-publish@v1.8.5
55+
with:
56+
repository-url: https://test.pypi.org/legacy/
57+
skip-existing: true
58+
verbose: true
59+
print-hash: true
60+

0 commit comments

Comments
 (0)