Skip to content

Bump fonttools from 4.43.0 to 4.43.1 #21

Bump fonttools from 4.43.0 to 4.43.1

Bump fonttools from 4.43.0 to 4.43.1 #21

---
name: Check for version change, add tag, build, and publish
permissions:
contents: write
on: # yamllint disable-line rule:truthy
pull_request:
types: [closed]
branches:
- main
jobs:
check_if_tag_exists:
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event.pull_request.merged == true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install toml package
run: pip install toml
- name: Extract version from pyproject.toml and check if tag exists
id: extract_version_and_check_tag
run: |
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
EXISTS=$(git ls-remote --tags origin refs/tags/"${VERSION}" | wc -l)
echo "tag_version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag_exists=${EXISTS}" >> "$GITHUB_OUTPUT"
outputs:
tag_version: ${{ steps.extract_version_and_check_tag.outputs.tag_version }}
tag_exists: ${{ steps.extract_version_and_check_tag.outputs.tag_exists }}
set_version_tag:
needs: check_if_tag_exists
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.event.pull_request.merged == true && needs.check_if_tag_exists.outputs.tag_exists != '1' }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Create new tag
run: git tag ${{ needs.check_if_tag_exists.outputs.tag_version }}
- name: Push new tag
run: git push origin ${{ needs.check_if_tag_exists.outputs.tag_version }}
outputs:
tag_set: "true"
build_and_publish:
needs: set_version_tag
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true && needs.set_version_tag.outputs.tag_set == 'true' }}
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install --upgrade poetry
- name: Extract version from tag
id: extract_version
run: |
TAG_NAME=$(git describe --tags --abbrev=0)
echo "VERSION=${TAG_NAME}" >> "$GITHUB_ENV"
- name: Extract repository name
run: echo "REPO_NAME=$(echo "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
- name: Build package
run: python -m poetry build
- name: Create GitHub Release and Upload Artifacts
env:
VERSION: ${{ env.VERSION }}
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
name: Release ${{ env.VERSION }}
artifacts: ./dist/${{ env.REPO_NAME }}-${{ env.VERSION }}-py3-none-any.whl,./dist/${{ env.REPO_NAME }}-${{ env.VERSION }}.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true