Skip to content

Commit

Permalink
fix: merge all release actions, separate tag and release jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
drodarie committed Jul 18, 2024
1 parent 2b29990 commit 70c1bfa
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 38 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/deploy-pypi.yml

This file was deleted.

57 changes: 45 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ on:
- main

jobs:
deploy:
bump:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.semver.outputs.next }}

steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -21,30 +24,35 @@ jobs:
token: ${{ github.token }}
branch: main

- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- uses: rickstaa/action-create-tag@v1
id: "tag_create"
with:
tag: ${{ steps.semver.outputs.next }}
github_token: ${{ github.token }}

- name: Checkout Code to update tag
release:
runs-on: ubuntu-latest
needs: bump

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ needs.bump.outputs.tag }} | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.semver.outputs.next }}
fromTag: ${{ needs.bump.outputs.tag }}
toTag: ${{ env.previousTag }}

- name: Create Release
Expand All @@ -53,8 +61,8 @@ jobs:
allowUpdates: true
draft: false
makeLatest: true
tag: ${{ steps.semver.outputs.next }}
name: ${{ steps.semver.outputs.next }}
tag: ${{ needs.bump.outputs.tag }}
name: ${{ needs.bump.outputs.tag }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}

Expand All @@ -64,3 +72,28 @@ jobs:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md

deploy:
runs-on: ubuntu-latest
needs: release

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload --verbose --repository testpypi dist/*

0 comments on commit 70c1bfa

Please sign in to comment.