Skip to content

Commit

Permalink
GHA release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jantman committed Dec 30, 2022
1 parent 88efb01 commit 2b88788
Showing 1 changed file with 41 additions and 23 deletions.
64 changes: 41 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Release on Tag
on: [push]
#on:
# push:
# tags:
# - '*'
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -18,17 +17,22 @@ jobs:
- name: Get Version
id: get-version
run: python dev/get_version.py
- name: Echo Version
- name: Ensure tag matches version
if: github.ref_name != steps.get-version.outputs.APP_VERSION
run: |
echo ${{ steps.get-version.outputs.APP_VERSION }}
- name: Echo Ref
run: |
echo ${{ github.ref_name }}
#- name: Ensure tag matches version
# if: github.ref_name != steps.get-version.outputs.APP_VERSION
# run: |
# echo "ERROR: tag name (${{ github.ref_name }}) does not match current version in version.py (${{ steps.get-version.outputs.APP_VERSION }})"
# exit 2
echo "ERROR: tag name (${{ github.ref_name }}) does not match current version in version.py (${{ steps.get-version.outputs.APP_VERSION }})"
exit 2
- name: Convert CHANGES to markdown
uses: docker://pandoc/core:2.19
with:
args: -f rst -t markdown --wrap=none --markdown-headings=atx --output=CHANGES.md CHANGES.rst
- name: Generate release changelog
run: python dev/get_changelog.py
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build
id: docker-build
env:
Expand All @@ -40,12 +44,26 @@ jobs:
echo ${{ steps.docker-build.outputs.DOCKER_IMG_TAG }}
- name: Build Python package
run: python -m build
- name: Convert CHANGES to markdown
uses: docker://pandoc/core:2.19
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
args: -f rst -t markdown --wrap=none --markdown-headings=atx --output=CHANGES.md CHANGES.rst
- name: Generate release changelog
run: python dev/get_changelog.py
- name: cat changes
run: cat release_log.md
# generates release_log.md
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Docker Push
run: |
docker push jantman/biweeklybudget:${{ steps.docker-build.outputs.DOCKER_IMG_TAG }}
docker tag jantman/biweeklybudget:${{ steps.docker-build.outputs.DOCKER_IMG_TAG }} jantman/biweeklybudget:${{ steps.get-version.outputs.APP_VERSION }}
docker push jantman/biweeklybudget:${{ steps.get-version.outputs.APP_VERSION }}
docker tag jantman/biweeklybudget:${{ steps.docker-build.outputs.DOCKER_IMG_TAG }} jantman/biweeklybudget:latest
docker push jantman/biweeklybudget:latest
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: release_log.md
draft: false
prerelease: false

0 comments on commit 2b88788

Please sign in to comment.