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

Use release action #4

Merged
merged 1 commit into from
May 7, 2024
Merged
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
61 changes: 9 additions & 52 deletions .github/workflows/python-package-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,16 @@ on:
- "v*.*.*"

jobs:
build:

runs-on: ubuntu-latest
test-build-and-release-package:
if: github.repository == 'hsorby/trc-data-reader'
strategy:
matrix:
python-version: [3.9]
runs-on: ubuntu-20.04
name: Release package
permissions:
contents: write
id-token: write

id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools build wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test
run: |
python -m unittest discover
- name: Create Release
id: create_release
uses: KaiWedekind/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ github.token }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
- name: "Generate release changelog"
uses: heinrichreimer/action-github-changelog-generator@v2.3
with:
token: ${{ github.token }}
- name: Add changelog to release
uses: irongut/EditRelease@v1.2.0
with:
token: ${{ github.token }}
id: ${{ steps.create_release.outputs.id }}
files: "CHANGELOG.md"
- name: Build
id: build
shell: bash
run: |
python --version
python -m build . --wheel
echo "dist content:"
ls dist/
- name: Publish to PyPi
env:
name: pypi
url: https://pypi.org/p/trc-data-reader
uses: pypa/gh-action-pypi-publish@release/v1
- name: Release Python package
uses: hsorby/release-python-package-action@v1
with:
pypi-package-name: trc-data-reader
run-tests: unittest