Skip to content

fix: publish to GH releases first #733

fix: publish to GH releases first

fix: publish to GH releases first #733

Workflow file for this run

name: Main
on:
push:
branches: ["*"] # Run only when push to branches (not tags).
paths-ignore:
- "codeforlife/version.py"
- "**/*.md"
- ".vscode/**"
- ".*"
workflow_dispatch:
jobs:
# test:
# uses: ocadotechnology/codeforlife-workspace/.github/workflows/test-python-code.yaml@main
# secrets: inherit
# with:
# # Cannot be set with an env var. Value must match in the release job.
# python-version: 3.12
# https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html#common-workflow-example
release:
concurrency: release
runs-on: ubuntu-latest
# needs: [test]
permissions:
id-token: write
contents: write
# Release if:
# - the repo's owner is Ocado Tech.
# - a change is made to the default branch.
if: |
github.repository_owner_id == 2088731 &&
github.ref_name == github.event.repository.default_branch
env:
# Value must match in the test job.
PYTHON_VERSION: 3.12
steps:
- name: 🛫 Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ github.sha }}
- name: 🛫 Checkout Branch on Workflow SHA
run: git checkout -B ${{ github.ref_name }} ${{ github.sha }}
- name: 🤖 Set up cfl-bot as Git User
uses: ocadotechnology/codeforlife-workspace/.github/actions/git/setup-bot@main
- name: 🆕 Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
git_committer_name: "cfl-bot"
git_committer_email: "[email protected]"
- name: 🚀 Publish to GitHub Releases
uses: python-semantic-release/[email protected]
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
- name: 🚀 Publish to PyPI
uses: pypa/[email protected]
if: steps.release.outputs.released == 'true'
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
# repository-url: https://pypi.org/p/codeforlife