ci: maybe fix GH description extraction for next time #38
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
# .github/workflows/build_and_publish.yml | |
name: CI | |
on: | |
push: | |
branches: | |
- master | |
# by default, permissions are read-only, read + write is required for git pushes | |
permissions: | |
contents: write | |
env: | |
PIP_DEFAULT_TIMEOUT: 60 | |
PIP_RETRIES: 5 | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: ASDF Parse | |
uses: kota65535/github-asdf-parse-action@v1.1.0 | |
id: versions | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ steps.versions.outputs.python }}" | |
- name: Install Poetry | |
uses: Gr1N/setup-poetry@v8 | |
with: | |
poetry-version: "${{ steps.versions.outputs.poetry }}" | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Make sure it runs | |
run: | | |
poetry run todoist-scheduler --help | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v5 | |
with: | |
github-token: ${{ secrets.github_token }} | |
version-file: "./pyproject.toml" | |
version-path: "tool.poetry.version" | |
fallback-version: "1.0.0" | |
output-file: "CHANGELOG.md" | |
# NOTE must run after versioning otherwise the right version won't be pushed | |
- name: Build distribution package | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
poetry build | |
- name: Publish to PyPI | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
# `gh secret set PYPI_API_TOKEN --app actions --body $PYPI_API_TOKEN` | |
poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} | |
- name: Github Release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
# output options: https://github.com/TriPSs/conventional-changelog-action#outputs | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
tag_name: ${{ steps.changelog.outputs.tag }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
# gh secret set GH_PERSONAL_TOKEN --app actions --body ghp_ | |
password: ${{ secrets.GH_PERSONAL_TOKEN }} | |
- name: Install nixpacks | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
curl -sSL https://nixpacks.com/install.sh | bash | |
- name: Nixpacks version | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
nixpacks --version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Build with nixpacks | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
# TODO remove this once nixpacks supports poetry | |
export NIXPACKS_PYTHON_VERSION="${{ steps.versions.outputs.python }}" | |
export NIXPACKS_POETRY_VERSION="${{ steps.versions.outputs.poetry }}" | |
make docker-push | |
- name: Sync Repository Metadata | |
# uses: kbrashears5/github-action-repo-sync@v1.0.0 | |
uses: iloveitaly/github-action-repo-sync@python | |
with: | |
TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }} |