Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Decouple git tag / PyPI release / Github release page #49

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/create-github-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create a GitHub release page

on:
push:
tags:
- '*.*.*'
workflow_dispatch:

permissions:
contents: write

jobs:
build_and_publish:
name: Create a GitHub release page
runs-on: ubuntu-latest
steps:
- name: Prepare variables
id: prepare_variables
run: |
git fetch --tags --force
latest_tag=$(git describe --tags --abbrev=0)
echo "latest_tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_ENV"
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "tag_body<<$EOF" >> "$GITHUB_ENV"
git --no-pager tag -l "${latest_tag}" --format='%(contents:body)' >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Create GitHub Release 🚀
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.latest_tag }}
name: Version ${{ env.latest_tag }}, ${{ env.date }}
draft: false
prerelease: false
body: ${{ env.tag_body }}
32 changes: 32 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Python Package to PyPI

on:
push:
tags:
- '*.*.*'
workflow_dispatch:

permissions:
contents: write

jobs:
build_and_publish:
name: Publish a new version
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Install Flit
run: |
python -m pip install --upgrade pip
pip install flit

- name: Publish Package to PyPI🚀
env:
FLIT_USERNAME: '__token__'
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: |
flit publish
39 changes: 0 additions & 39 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
runs-on: ubuntu-latest
if: "${{ startsWith(github.event.head_commit.message, 'REL: ') }}"
steps:
# Ensure it's on PyPI
- name: Checkout Repository
uses: actions/checkout@v4

Expand Down Expand Up @@ -46,41 +45,3 @@ jobs:
git config user.email [email protected]
git tag "$VERSION" -m "$MESSAGE"
git push origin $VERSION

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Install Flit
run: |
python -m pip install --upgrade pip
pip install flit

- name: Publish Package to PyPI🚀
env:
FLIT_USERNAME: '__token__'
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: |
flit publish

# Create the Github Page
- name: Prepare variables
id: prepare_variables
run: |
git fetch --tags --force
latest_tag=$(git describe --tags --abbrev=0)
echo "latest_tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_ENV"
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "tag_body<<$EOF" >> "$GITHUB_ENV"
git --no-pager tag -l "${latest_tag}" --format='%(contents:body)' >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Create GitHub Release 🚀
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.latest_tag }}
name: Version ${{ env.latest_tag }}, ${{ env.date }}
draft: false
prerelease: false
body: ${{ env.tag_body }}
Loading