production #1328
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.11" | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4 | |
with: | |
token: ${{ secrets.flexgetbot_pat }} | |
fetch-depth: 0 | |
- name: Setup Git User | |
run: | | |
git config user.email ${{ secrets.git_email }} | |
git config user.name ${{ secrets.git_user }} | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
cache-dependency-path: 'dev-requirements.txt' | |
- name: Install dev dependencies | |
run: | | |
pip install -r requirements-release.txt | |
- name: Set Deployment Status Pending | |
uses: justacodename/deployment-status@v2 | |
with: | |
state: pending | |
- name: Run release script | |
env: | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: ${{ secrets.pypi_token }} | |
run: | | |
./release.sh | |
- name: Build Changelog | |
id: changelog | |
if: env.release_tag | |
run: | | |
echo 'CHANGELOG_BODY<<EOF' >> $GITHUB_ENV | |
python dev_tools.py get-changelog ${{ env.release_tag }} >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
if: env.release_tag | |
with: | |
tag: ${{ env.release_tag }} | |
artifacts: "dist/*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: ${{ env.CHANGELOG_BODY }} | |
- name: Set Deployment Status Success | |
uses: justacodename/deployment-status@v2 | |
with: | |
state: success | |
- name: Set Deployment Status Failure | |
if: failure() || cancelled() | |
uses: justacodename/deployment-status@v2 | |
with: | |
state: failure |