Skip to content

Commit

Permalink
Merge pull request #94 from ALRhub/publish_from_release
Browse files Browse the repository at this point in the history
Publish from release
  • Loading branch information
D-o-d-o-x authored Feb 10, 2024
2 parents d8940ac + 0a883f3 commit f7ccfc8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 61 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ensure-release-tagged.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ensure Tagged Commits on Release

on:
pull_request:
branches:
- release

jobs:
check_tag:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if base commit of PR is tagged
run: |
BASE_COMMIT=$(jq -r .pull_request.base.sha < "$GITHUB_EVENT_PATH")
TAG=$(git tag --contains $BASE_COMMIT)
if [ -z "$TAG" ]; then
echo "Base commit of PR is not tagged. PRs onto release must be tagged with the version number."
exit 1
fi
echo "Base commit of PR is tagged. Check passed."
16 changes: 7 additions & 9 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@ name: Publish Python package to PyPI

on:
push:
tags:
- '*'
branches:
- release

jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if: false && startsWith(github.ref, 'refs/tags/') # Only run on tagged commits

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # This fetches all history for all branches and tags

- name: Verify tag is on master branch
- name: Check if commit is tagged
run: |
TAG_IS_ON_MASTER=$(git branch -r --contains ${{ github.ref }} | grep 'origin/master')
if [ -z "$TAG_IS_ON_MASTER" ]; then
echo "Tag is not on the master branch. Cancelling the workflow."
TAG=$(git tag --contains HEAD)
if [ -z "$TAG" ]; then
echo "Commit is not tagged. Failing the workflow."
exit 1
fi
echo "Tag is on the master branch. Proceeding with the workflow."
echo "Commit is tagged. Proceeding with the workflow."
- name: Set up Python
uses: actions/setup-python@v4
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/publish-to-test-pypi.yml

This file was deleted.

0 comments on commit f7ccfc8

Please sign in to comment.