-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84c2c67
commit b3dbfa6
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Test Release Workflow on Release Branch | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
branches: | ||
- release # Change from main to release for testing | ||
|
||
jobs: | ||
validate-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Validate Tag Format | ||
run: | | ||
TAG_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?$' | ||
TAG="${GITHUB_REF/refs\/tags\//}" | ||
if [[ "$TAG" =~ $TAG_REGEX ]]; then | ||
echo "Tag format is valid." | ||
else | ||
echo "::error::Tag $TAG does not match the 'vMAJOR.MINOR.PATCH' or 'vMAJOR.MINOR.PATCH-pre-release' format." | ||
exit 1 | ||
shell: bash | ||
|
||
|
||
build-and-test: | ||
needs: validate-tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install | ||
- name: Run tests | ||
run: | | ||
poetry run pytest | ||
dry-run-publish: | ||
needs: build-and-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Build the distribution | ||
run: poetry build | ||
- name: Dry run publish to PyPI | ||
run: poetry publish --dry-run | ||
# This step simulates the publishing process without making actual changes | ||
|
||
# The GitHub release creation is commented out to avoid creating releases during tests | ||
# create-github-release: | ||
# needs: dry-run-publish | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Create Release on GitHub | ||
# id: create_release | ||
# uses: actions/create-release@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: ${{ github.ref_name }} | ||
# release_name: Release ${{ github.ref_name }} | ||
# body: 'Test automated release of version ${{ github.ref_name }}' | ||
# draft: false | ||
# prerelease: false |