Skip to content

Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 #193

Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7

Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 #193

Workflow file for this run

---
name: Test
on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]
jobs:
test:
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
env:
PYTEST_ADDOPTS: '--color=yes'
outputs:
relver: ${{ steps.setvars.outputs.relver }}
branch: ${{ steps.setvars.outputs.branch }}
changelogver: ${{ steps.setvars.outputs.changelogver }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
- name: Requirements
working-directory: tests
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Pytest
run: pytest tests/
- name: Set vars
id: setvars
run: |
VER_TAG=${GITHUB_REF/refs\/tags\/v/}
echo "relver=${VER_TAG}" >> $GITHUB_OUTPUT
echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "changelogver=v${VER_TAG//\./-}" >> $GITHUB_OUTPUT
- name: Coverage
uses: codecov/codecov-action@v3
build:
needs: [test]
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build amd64
uses: docker/build-push-action@v4
with:
push: false
context: .
load: true
platforms: linux/amd64
tags: galactory:latest
- name: Run container
run: docker run --rm galactory --help
- name: Build arm64
uses: docker/build-push-action@v4
with:
push: false
context: .
platforms: linux/arm64
tags: galactory:latest
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Pre-reqs
run: pip install --upgrade pip setuptools build twine
- name: Build
run: python -m build
- name: Test build
run: python -m twine check dist/*
- name: Check version
id: checkver
if: startsWith(github.ref, 'refs/tags/')
run: |
VER_TAG=${{ needs.test.outputs.relver }}
expected_sdist=galactory-${VER_TAG}.tar.gz
expected_wheel=galactory-${VER_TAG}-py3-none-any.whl
if [ ! -f "dist/${expected_sdist}" ] || [ ! -f "dist/${expected_wheel}" ]
then
exit 1
fi
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: ${{ github.event_name == 'push' && 90 || 7 }}
if-no-files-found: error
release:
needs: [test, build]
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
UPSTREAM: ghcr.io/${{ github.repository_owner }}/galactory
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to registry
if: github.event_name == 'push'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build & Push
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name == 'push' }}
context: .
platforms: linux/amd64,linux/arm64
tags: |
${{ env.UPSTREAM }}:${{ startsWith(github.ref, 'refs/tags/') && 'latest' || needs.test.outputs.branch }}
${{ env.UPSTREAM }}:${{ startsWith(github.ref, 'refs/tags/') && needs.test.outputs.relver || github.sha }}
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@f5622bde02b04381239da3573277701ceca8f6a0
with:
user: __token__
password: ${{ secrets.pypi }}
- uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
fail_on_unmatched_files: true
files: dist/*
body: |
PyPI: https://pypi.org/project/galactory/${{ needs.test.outputs.relver }}/
Container: `ghcr.io/${{ github.repository }}:${{ needs.test.outputs.relver }}`
Browse container tags: https://github.com/briantist/galactory/pkgs/container/galactory
Changelog: https://github.com/briantist/galactory/blob/main/CHANGELOG.rst#${{ needs.test.outputs.changelogver }}