Merge pull request #49 from siemdejong/ruff #111
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-cd | |
on: [push, pull_request] | |
jobs: | |
release: | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
# Only run this job if new work is pushed to "main" | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
# Set up operating system | |
runs-on: ubuntu-latest | |
environment: release | |
# Define job steps | |
steps: | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Setup | Checkout Repository at workflow sha | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
ref: ${{ github.sha }} | |
- name: Setup | Force correct release branch on workflow sha | |
run: git checkout -B ${{ github.ref_name }} ${{ github.sha }} | |
- name: Install babel | |
run: pip install Babel | |
- name: Build MO files | |
run: python setup.py compile_catalog | |
- name: Action | Semantic Version Release | |
id: release | |
# Adjust tag with desired version if applicable. | |
uses: python-semantic-release/python-semantic-release@v9.9.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
git_committer_name: "github-actions" | |
git_committer_email: "actions@users.noreply.github.com" | |
- name: Publish to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: steps.release.outputs.released == 'true' | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
verbose: true | |
- name: Test install from TestPyPI | |
if: steps.release.outputs.released == 'true' | |
run: | | |
pip install \ | |
--index-url https://test.pypi.org/simple/ \ | |
--extra-index-url https://pypi.org/simple \ | |
shithappens | |
- name: Publish to PyPI | |
if: steps.release.outputs.released == 'true' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Test install from PyPI | |
if: steps.release.outputs.released == 'true' | |
run: | | |
pip install shithappens --force-reinstall | |
- name: Publish | Upload to GitHub Release Assets | |
uses: python-semantic-release/publish-action@v9.9.0 | |
if: steps.release.outputs.released == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.release.outputs.tag }} |