Skip to content

Update ci-cd.yml

Update ci-cd.yml #200

Workflow file for this run

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@v5
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: 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 \
ithappens
- 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 ithappens --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 }}