production #1
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: Build and release to PyPI | |
on: [ deployment ] | |
permissions: { } | |
jobs: | |
release: | |
permissions: | |
contents: write # for git push | |
deployments: write # to create a deployment status | |
runs-on: ubuntu-latest | |
env: | |
PYTHON_VERSION: '3.13' # renovate: datasource=python-version depName=python | |
UV_VERSION: 0.5.22 # renovate: datasource=pypi depName=uv | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
token: ${{ secrets.flexgetbot_pat }} | |
fetch-depth: 0 | |
- name: Setup Git User | |
run: | | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git config user.name github-actions[bot] | |
- name: Install uv and Python | |
uses: astral-sh/setup-uv@b5f58b2abc5763ade55e4e9d0fe52cd1ff7979ca # v5 | |
with: | |
enable-cache: true | |
python-version: ${{ env.PYTHON_VERSION }} | |
version: ${{ env.UV_VERSION }} | |
- name: Set Deployment Status Pending | |
uses: justacodename/deployment-status@f758c04198a9855518022f1e3b990989381d9543 # v2 | |
with: | |
state: pending | |
- name: Run release script | |
env: | |
UV_PUBLISH_TOKEN: ${{ secrets.pypi_token }} | |
run: | | |
scripts/release.sh | |
- name: Build Changelog | |
id: changelog | |
if: env.release_tag | |
run: | | |
echo 'CHANGELOG_BODY<<EOF' >> $GITHUB_ENV | |
uv run scripts/dev_tools.py get-changelog ${{ env.release_tag }} >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Export config schema | |
if: env.release_tag | |
run: | | |
echo 'tasks: {}' > config.yml | |
uv run flexget export-schema --output-file flexget-config.schema.json | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1 | |
if: env.release_tag | |
with: | |
tag: ${{ env.release_tag }} | |
artifacts: dist/*,flexget-config.schema.json | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: ${{ env.CHANGELOG_BODY }} | |
- name: Set Deployment Status Success | |
uses: justacodename/deployment-status@f758c04198a9855518022f1e3b990989381d9543 # v2 | |
with: | |
state: success | |
- name: Set Deployment Status Failure | |
if: failure() || cancelled() | |
uses: justacodename/deployment-status@f758c04198a9855518022f1e3b990989381d9543 # v2 | |
with: | |
state: failure |