mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2026-03-10 23:17:21 -04:00
130 lines
5.0 KiB
YAML
130 lines
5.0 KiB
YAML
name: Prepare Release
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
new_stable_version:
|
|
description: Version number for the new stable release (leave empty to just strip `.dev1`)
|
|
required: false
|
|
default: 'auto'
|
|
|
|
jobs:
|
|
crowdin_download_translations:
|
|
environment: Prepare Release
|
|
needs: pr_stable_bump
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/create-github-app-token@v2
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.RED_RELEASER_CLIENT_ID }}
|
|
private-key: ${{ secrets.RED_RELEASER_PRIVATE_KEY }}
|
|
|
|
# Checkout repository and install Python
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.8'
|
|
- name: Install dependencies
|
|
run: |
|
|
curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
|
|
echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y crowdin3
|
|
pip install redgettext==3.4.2
|
|
|
|
- name: Generate source files
|
|
run: |
|
|
make gettext
|
|
- name: Download translations
|
|
run: |
|
|
make download_translations
|
|
env:
|
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_IDENTIFIER }}
|
|
|
|
- name: Create Pull Request
|
|
id: cpr_crowdin
|
|
uses: peter-evans/create-pull-request@v4
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
commit-message: Automated Crowdin downstream
|
|
title: "Automated Crowdin downstream"
|
|
body: |
|
|
This is an automated PR that is part of Prepare Release automated workflow (2 out of 2).
|
|
Please ensure that there are no errors or invalid files are in the PR.
|
|
labels: "Automated PR, Changelog Entry: Skipped"
|
|
branch: "automated/i18n"
|
|
committer: >-
|
|
${{ steps.app-token.outputs.app-slug }}[bot]
|
|
<263745220+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>
|
|
author: >-
|
|
${{ steps.app-token.outputs.app-slug }}[bot]
|
|
<263745220+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>
|
|
milestone: ${{ needs.pr_stable_bump.outputs.milestone_number }}
|
|
|
|
pr_stable_bump:
|
|
environment: Prepare Release
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
milestone_number: ${{ steps.get_milestone_number.outputs.result }}
|
|
steps:
|
|
- uses: actions/create-github-app-token@v2
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.RED_RELEASER_CLIENT_ID }}
|
|
private-key: ${{ secrets.RED_RELEASER_PRIVATE_KEY }}
|
|
|
|
# Checkout repository and install Python
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.8'
|
|
|
|
# Create PR for stable version bump
|
|
- name: Update Red version number from input
|
|
id: bump_version_stable
|
|
run: |
|
|
python .github/workflows/scripts/bump_version.py
|
|
env:
|
|
PYTHONPATH: ${{ github.workspace }}:${{ env.PYTHONPATH }}
|
|
NEW_STABLE_VERSION: ${{ github.event.inputs.new_stable_version }}
|
|
|
|
# Get milestone number of the milestone for the new stable version
|
|
- name: Get milestone number
|
|
id: get_milestone_number
|
|
uses: actions/github-script@v6
|
|
env:
|
|
MILESTONE_TITLE: ${{ steps.bump_version_stable.outputs.new_version }}
|
|
with:
|
|
script: |
|
|
const script = require(
|
|
`${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/get_milestone_number_by_exact_title.js`
|
|
);
|
|
return await script({github, context});
|
|
|
|
- name: Create Pull Request
|
|
id: cpr_bump_stable
|
|
uses: peter-evans/create-pull-request@v4
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
commit-message: Version bump to ${{ steps.bump_version_stable.outputs.new_version }}
|
|
title: Version bump to ${{ steps.bump_version_stable.outputs.new_version }}
|
|
body: |
|
|
This is an automated PR that is part of Prepare Release automated workflow (1 out of 2).
|
|
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_stable.outputs.new_version }}"
|
|
committer: >-
|
|
${{ steps.app-token.outputs.app-slug }}[bot]
|
|
<263745220+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>
|
|
author: >-
|
|
${{ steps.app-token.outputs.app-slug }}[bot]
|
|
<263745220+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>
|
|
milestone: ${{ steps.get_milestone_number.outputs.result }}
|