1.0.1 #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Package | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Library | |
run: | | |
python -m pip install . | |
python -m pip install setuptools | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Check version | |
run: | | |
LIBRARY_VERSION=$(unassign --version) | |
GITHUB_VERSION=${{ steps.get_version.outputs.version-without-v }} | |
if [[ $LIBRARY_VERSION == $GITHUB_VERSION ]]; then | |
echo "Versions match, continuing..." | |
else | |
echo "Versions don't match, exiting..." | |
echo "Library version: $LIBRARY_VERSION" | |
echo "GitHub version: $GITHUB_VERSION" | |
exit 1 | |
fi | |
run-tests: | |
uses: ./.github/workflows/test.yml | |
secrets: inherit | |
build-and-publish-to-pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: [run-tests, check-version] | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
build-and-push-to-dockerhub: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: [run-tests, check-version] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ctbushman/unassigner | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |