mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
[GitHub] Create release action workflows (#5743)
* Create release actions * Add release branch to push/pull events that invoke test workflows
This commit is contained in:
parent
cedeaf8668
commit
9283be652d
73
.github/workflows/create-release.yml
vendored
Normal file
73
.github/workflows/create-release.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
name: Create Release Branch
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
versionName:
|
||||
description: "Name of version (i.e. 1.9.0)"
|
||||
type: string
|
||||
required: true
|
||||
confirmVersion:
|
||||
type: string
|
||||
required: true
|
||||
description: "Confirm version name"
|
||||
|
||||
# explicitly specify the necessary scopes
|
||||
permissions:
|
||||
pull-requests: write
|
||||
actions: write
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
if: github.repository == 'pagefaultgames/pokerogue' && (vars.BETA_DEPLOY_BRANCH == '' || ! startsWith(vars.BETA_DEPLOY_BRANCH, 'release'))
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for github cli commands
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Validate provided version
|
||||
# Ensure version matches confirmation and conforms to expected pattern.
|
||||
run: |
|
||||
if [[ "${{ github.event.inputs.versionName }}" != "${{ github.event.inputs.confirmVersion }}" ]]; then
|
||||
echo "Version name does not match confirmation. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! "${{ github.event.inputs.versionName }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Version name must follow the format X.Y.Z where X, Y, and Z are all numbers. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
# Always base off of beta branch, regardless of the branch the workflow was triggered from.
|
||||
ref: beta
|
||||
- name: Create release branch
|
||||
run: git checkout -b release
|
||||
# In order to be able to open a PR into beta, we need the branch to have at least one change.
|
||||
- name: Overwrite RELEASE file
|
||||
run: |
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
echo "Release v${{ github.event.inputs.versionName }}" > RELEASE
|
||||
git add RELEASE
|
||||
git commit -m "Stage release v${{ github.event.inputs.versionName }}"
|
||||
- name: Push new branch
|
||||
run: git push origin release
|
||||
# The repository variable is used by the deploy-beta workflow to determine whether to deploy from beta or release.
|
||||
- name: Set repository variable
|
||||
run: GITHUB_TOKEN="${{ secrets.RW_VARS_PAT }}" gh variable set BETA_DEPLOY_BRANCH --body "release"
|
||||
- name: Create pull request to main
|
||||
run: |
|
||||
gh pr create --base main \
|
||||
--head release \
|
||||
--title "Release v${{ github.event.inputs.versionName }} to main" \
|
||||
--body "This PR is for the release of v${{ github.event.inputs.versionName }}, and was created automatically by the GitHub Actions workflow invoked by ${{ github.actor }}" \
|
||||
--draft
|
||||
- name: Create pull request to beta
|
||||
run: |
|
||||
gh pr create --base beta \
|
||||
--head release \
|
||||
--title "Release v${{ github.event.inputs.versionName }} to beta" \
|
||||
--body "This PR is for the release of v${{ github.event.inputs.versionName }}, and was created automatically by the GitHub Actions workflow invoked by ${{ github.actor }}" \
|
||||
--draft
|
15
.github/workflows/deploy-beta.yml
vendored
15
.github/workflows/deploy-beta.yml
vendored
@ -4,18 +4,23 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- beta
|
||||
- release
|
||||
workflow_run:
|
||||
types: completed
|
||||
workflows: ["Post Release Deleted"]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: github.repository == 'pagefaultgames/pokerogue'
|
||||
if: github.repository == 'pagefaultgames/pokerogue' && github.ref_name == ${{ vars.BETA_DEPLOY_BRANCH || 'beta' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
submodules: "recursive"
|
||||
ref: ${{ vars.BETA_DEPLOY_BRANCH || 'beta'}}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
node-version-file: ".nvmrc"
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build
|
||||
@ -30,5 +35,5 @@ jobs:
|
||||
chmod 600 ~/.ssh/*
|
||||
ssh-keyscan -H ${{ secrets.BETA_SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
- name: Deploy build on server
|
||||
run: |
|
||||
rsync --del --no-times --checksum -vrm dist/* ${{ secrets.BETA_SSH_USER }}@${{ secrets.BETA_SSH_HOST }}:${{ secrets.BETA_DESTINATION_DIR }}
|
||||
run: |
|
||||
rsync --del --no-times --checksum -vrm dist/* ${{ secrets.BETA_SSH_USER }}@${{ secrets.BETA_SSH_HOST }}:${{ secrets.BETA_DESTINATION_DIR }}
|
||||
|
12
.github/workflows/post-release-deleted.yml
vendored
Normal file
12
.github/workflows/post-release-deleted.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
name: Post Release Deleted
|
||||
on:
|
||||
delete:
|
||||
|
||||
jobs:
|
||||
# Set the BETA_DEPLOY_BRANCH variable to beta when a release branch is deleted
|
||||
update-release-var:
|
||||
if: github.repository == 'pagefaultgames/pokerogue' && github.event.ref_type == 'branch' && github.event.ref == 'release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set BETA_DEPLOY_BRANCH to beta
|
||||
run: GITHUB_TOKEN="${{ secrets.RW_VARS_PAT }}" gh variable set BETA_DEPLOY_BRANCH --body "beta" --repo "pagefaultgames/pokerogue"
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -7,6 +7,7 @@ on:
|
||||
branches:
|
||||
- main # Trigger on push events to the main branch
|
||||
- beta # Trigger on push events to the beta branch
|
||||
- release # Trigger on push events to the release branch
|
||||
# go upvote https://github.com/actions/runner/issues/1182 and yell at microsoft until they fix this or ditch yml for workflows
|
||||
paths:
|
||||
# src and test files
|
||||
@ -32,6 +33,7 @@ on:
|
||||
branches:
|
||||
- main # Trigger on pull request events targeting the main branch
|
||||
- beta # Trigger on pull request events targeting the beta branch
|
||||
- release # Trigger on pull request events targeting the release branch
|
||||
paths: # go upvote https://github.com/actions/runner/issues/1182 and yell at microsoft because until then we have to duplicate this
|
||||
# src and test files
|
||||
- "src/**"
|
||||
|
Loading…
Reference in New Issue
Block a user