Skip to content

Commit

Permalink
Merge pull request #42 from teutoburg/releaseflow
Browse files Browse the repository at this point in the history
Attempt to fix workflow
  • Loading branch information
teutoburg authored Dec 23, 2023
2 parents 4e483fb + 7cb5a05 commit 3d79a56
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 11 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Bump package version
on:
workflow_dispatch:
inputs:
dry-run:
type: boolean
description: Only output new version number, no actual change.
required: false
rule:
type: choice
description: Version bump level
required: true
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
- "prerelease --next-phase"

workflow_call:
inputs:
dry-run:
type: boolean
description: Only output new version number, no actual change.
required: false
rule:
type: string
description: Version bump level
required: true
outputs:
bumpmsg:
description: Message created by the version bump.
value: ${{ jobs.bump.outputs.bumpmsg }}

jobs:
bump:
name: Bump version number
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
bumpmsg: ${{ steps.bumping.outputs.BUMP_MSG }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Set up Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.7.0"

- name: Bump package Version using Poetry
id: bumping
env:
RULE: ${{ inputs.rule }}
DRY: ${{ inputs.dry-run && '--dry-run' || '' }}
run: echo "BUMP_MSG=$(poetry version $DRY $RULE)" >> $GITHUB_OUTPUT

- name: Output debug msg
if: inputs.dry-run
env:
BUMP_MSG: ${{ steps.bumping.outputs.BUMP_MSG }}
run: |
echo "## $BUMP_MSG" >> $GITHUB_STEP_SUMMARY
echo "Dry run only, no actual modification made." >> $GITHUB_STEP_SUMMARY
- name: Commit changes
# could also use https://github.com/stefanzweifel/git-auto-commit-action instead
if: ${{ ! inputs.dry-run }}
env:
BUMP_MSG: ${{ steps.bumping.outputs.BUMP_MSG }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am "$BUMP_MSG"
git push
echo "## $BUMP_MSG" >> $GITHUB_STEP_SUMMARY
echo "Successfully committed and pushed version bump." >> $GITHUB_STEP_SUMMARY
24 changes: 14 additions & 10 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ jobs:
name: distribution
path: dist/

- name: Upload release attachment
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*

publish:
name: Publish package to PyPI
runs-on: ubuntu-latest
needs: build
if: needs.build.result == "success"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -60,16 +67,13 @@ jobs:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish

upload:
name: Upload dist to release
bump:
name: Bump to dev version
runs-on: ubuntu-latest
needs: build
needs: publish
if: needs.publish.result == "success"
steps:
- name: Retrieve distribution files
uses: actions/download-artifact@v3
- name: Checkout code
uses: ./.github/workflows/bump.yml
with:
name: distribution
path: dist/

- name: Upload release attachment
run: echo ${{ github.event.release.upload_url }}
rule: prerelease
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prepipy"
version = "0.7.1a2"
version = "0.7.1a3"
description = "Provides the ability to stretch and combine astronomical images from multiple bands into (RGB) colour images."
authors = ["Fabian Haberhauer <[email protected]>"]
maintainers = ["teutoburg <[email protected]>"]
Expand Down

0 comments on commit 3d79a56

Please sign in to comment.