Skip to content

Merge pull request #3 from jackylamhk/dev #10

Merge pull request #3 from jackylamhk/dev

Merge pull request #3 from jackylamhk/dev #10

Workflow file for this run

name: Build and publish
on:
push:
branches:
- main
paths:
- http_csp/**
- pyproject.toml
- poetry.lock
permissions:
id-token: write
contents: write
jobs:
version-tag:
name: Version tagging
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.tag-version.outputs.new_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Determine new version number
id: tag-version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: Set up Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: false
installer-parallel: true
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Bump Poetry version
run: |
poetry version ${{ steps.tag-version.outputs.new_version }}
git add pyproject.toml
git commit -m "chore: Bump poetry version [skip ci]"
git push
- name: Create Git tag
run: |
git tag ${{ steps.tag-version.outputs.new_tag }}
git push origin --tags
- name: Create Git release if pushed to main
if: github.ref_name == 'main'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag-version.outputs.new_tag }}
name: Release ${{ steps.tag-version.outputs.new_tag }}
body: ${{ steps.tag-version.outputs.changelog }}
build-publish:
name: Build and publish
runs-on: ubuntu-latest
needs: version-tag
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: false
installer-parallel: true
- name: Build project
run: poetry build
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
path: dist
name: python-package-build