Red-DiscordBot/.github/workflows/publish_release.yml
jack1142 c5fbf5fb94
Change things up with Crowdin and release-related workflows (#4833)
* Alternative way of doing Crowdin...

* Limit the upload translations workflow to V3/develop

* Make the workflow close and reopen the PR automatically while I'm at it

* Add a workflow for preparing PRs for release

* Make the crowdin env vars local to the step requiring them

* Move dev bump to Publish Release workflow
2021-02-18 14:43:21 +01:00

68 lines
2.3 KiB
YAML

name: Publish the release
on:
push:
tags:
- "*"
jobs:
release_to_pypi:
if: github.repository == 'Cog-Creators/Red-DiscordBot'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
pr_dev_bump:
needs: release_to_pypi
runs-on: ubuntu-latest
steps:
# Version bump to development version
- name: Update Red version number to dev
id: bump_version_dev
run: |
python .github/workflows/scripts/bump_version.py
env:
PYTHONPATH: ${{ github.workspace }}:${{ env.PYTHONPATH }}
DEV_BUMP: '1'
- name: Create Pull Request
id: cpr_bump_dev
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Version bump to ${{ steps.bump_version_dev.outputs.new_version }}
title: Version bump to ${{ steps.bump_version_dev.outputs.new_version }}
body: |
This is an automated PR.
Please ensure that there are no errors or invalid files are in the PR.
labels: "Automated PR, Changelog Entry: Skipped"
branch: "automated/pr_bumps/${{ steps.bump_version_dev.outputs.new_version }}"
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- name: Close and reopen the PR with different token to trigger CI
uses: actions/github-script@v3
env:
PR_NUMBER: ${{ steps.cpr_bump_dev.outputs.pull-request-number }}
PR_OPERATION: ${{ steps.cpr_bump_dev.outputs.pull-request-operation }}
with:
github-token: ${{ secrets.cogcreators_bot_repo_scoped }}
script: |
const script = require(
`${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/close_and_reopen_pr.js`
);
console.log(await script({github, context}));