Skip to content

Commit

Permalink
Modernise GitHub workflows
Browse files Browse the repository at this point in the history
* Drop 'get-tag' action use
* Use trusted publishing to PyPI
* Update action versions
* Test with Python 3.10-3.13 as well
  • Loading branch information
EpicWink committed Nov 21, 2024
1 parent 6bbd4f4 commit 9e809f8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,23 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: olegtarasov/[email protected]
id: get-tag
- uses: actions/checkout@v4
- name: Build image
run: docker build . -t epicwink/seddy:${{ steps.get-tag.outputs.tag }}
run: docker build . -t epicwink/seddy:${{ github.ref_name }}
- name: Login to DockerHub
run: >
echo ${{ secrets.DOCKERHUB_PASSWORD }}
| docker login --password-stdin -u epicwink
- name: Publish image
run: docker push epicwink/seddy:${{ steps.get-tag.outputs.tag }}
run: docker push epicwink/seddy:${{ github.ref_name }}
- name: Check tag
id: check-tag
run: |
if [[ ${{ steps.get-tag.outputs.tag }} =~ ^v\d+\.\d+\.\d+$ ]]; then
if [[ "${{ github.ref_name }}" =~ '^v\d+\.\d+\.\d+$' ]]; then
echo ::set-output name=match::true
fi
- name: Publish latest image
if: steps.check-tag.outputs.match == 'true'
run: |
docker tag epicwink/seddy:${{ steps.get-tag.outputs.tag }} epicwink/seddy:latest
docker tag epicwink/seddy:${{ github.ref_name }} epicwink/seddy:latest
docker push epicwink/seddy:latest
18 changes: 9 additions & 9 deletions .github/workflows/publish-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ on:
jobs:
release:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/seddy
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
- name: Update pip
run: pip install -U pip
- name: Build package
run: |
apt-get update && apt-get install -y git
pip install build
python -m build --sdist --wheel .
python -m build --outdir dist .
- name: Publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install twine
twine upload dist/*
uses: pypa/gh-action-pypi-publish@release/v1
15 changes: 11 additions & 4 deletions .github/workflows/test-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
include:
- os: ubuntu-20.04
python-version: '3.6'
- os: ubuntu-22.04
python-version: '3.7'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
Expand Down

0 comments on commit 9e809f8

Please sign in to comment.