Skip to content

Commit

Permalink
Merge pull request #578 from martinfleis/changelog
Browse files Browse the repository at this point in the history
GHA: update release action
  • Loading branch information
martinfleis authored Sep 29, 2023
2 parents a495cb9 + 520c2ee commit 3576691
Showing 1 changed file with 24 additions and 32 deletions.
56 changes: 24 additions & 32 deletions .github/workflows/release_and_publish.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,57 @@
# Release package on GitHub and publish to PyPI

# Important: In order to trigger this workflow for the organization
# repo (organzation-name/repo-name vs. user-name/repo-name), a tagged
# commit must be made to *organzation-name/repo-name*. If the tagged
# commit is made to *user-name/repo-name*, a release will be published
# under the user's name, not the organzation.

#--------------------------------------------------
name: Release & Publish

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

workflow_dispatch:
inputs:
version:
description: Manual Release
default: test
required: false

jobs:
build:
name: Create release & publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

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

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: run Changelog
run: |
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=-1 --ExecutePreprocessor.kernel_name=python3 tools/gitcount.ipynb
- name: cat Changelog
uses: pCYSl5EDgo/cat@master
id: changetxt
with:
path: ./tools/changelog.md
env:
TEXT: ${{ steps.changetxt.outputs.text }}

- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Release
uses: softprops/action-gh-release@v1
- name: Create Release Notes
uses: actions/github-script@v6
with:
body: ${{ steps.changetxt.outputs.text }}
body_path: ${{ steps.changetxt.outputs.path }}
name: Release ${{ env.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.ref }}",
generate_release_notes: true
});
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}

0 comments on commit 3576691

Please sign in to comment.