Revive #724
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: ci | |
on: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
pull_request: | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- uses: pdm-project/setup-pdm@v3 | |
- run: pdm sync -d | |
- run: pdm run ruff check | |
- run: pdm run ruff format --check | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- uses: pdm-project/setup-pdm@v3 | |
- run: pdm sync -d | |
- run: pdm run pytest | |
docker: | |
name: Docker | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log into docker | |
run: docker login docker.pkg.github.com -u bahlo -p "${{ secrets.GITHUB_TOKEN }}" | |
- name: Build docker container | |
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags') | |
run: docker build -t docker.pkg.github.com/bahlo/ing-ynab/ing-ynab:branch . | |
- name: Build and publish docker latest | |
if: github.ref == 'refs/heads/main' | |
run: | | |
docker build -t docker.pkg.github.com/bahlo/ing-ynab/ing-ynab:latest . | |
docker push docker.pkg.github.com/bahlo/ing-ynab/ing-ynab:latest | |
- name: Build and publish docker image | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
export TAG=$(echo "${{ github.ref }}" | sed 's/^refs\/tags\/v//g') | |
docker build -t docker.pkg.github.com/bahlo/ing-ynab/ing-ynab:$TAG . | |
docker push docker.pkg.github.com/bahlo/ing-ynab/ing-ynab:$TAG | |
publish: | |
name: Publish on PyPi | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
needs: | |
- check | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- uses: pdm-project/setup-pdm@v3 | |
- run: pdm publish | |
env: | |
PDM_PUBLISH_USERNAME: "__token__" | |
PDM_PUBLISH_PASSWORD: "${{ secrets.PYPI_TOKEN }}" |