modded7/.github/workflows/releasecommit.yml

134 lines
4.8 KiB
YAML

name: Create Release Commit
on:
workflow_dispatch:
inputs:
tag:
description: |
Tag to release (aka 1.6.1a, 1.6.1-beta-3, 2.0, etc.).
If this is just a release, then the version will be grabbed from the top line of version.txt. However, this field is needed if version.txt does not exist or is empty.
type: string
required: false
release_type:
description: 'Release Type. Will be ignored if not a release.'
type: choice
required: false
default: 'Release'
options:
- 'Release'
- 'Beta Release'
- 'Alpha Release'
update_files:
description: |
Whether this commit is just to update files. version.txt will not be changed. This is used when the templates are changed, and the main files need to be updated.
type: boolean
required: true
default: false
workflow_call:
inputs:
tag:
description: |
Tag to release (aka 1.6.1a, 1.6.1-beta-3, 2.0, etc.).
If this is just a release, then the version will be grabbed from the top line of version.txt. However, this field is needed if version.txt does not exist or is empty.
type: string
required: false
release_type:
description: 'Release Type. Will be ignored if not a release.'
type: string
required: false
update_files:
description: |
Whether this commit is just to update files. version.txt will not be changed. This is used when the templates are changed, and the main files need to be updated.
type: boolean
required: false
default: false
jobs:
createReleaseCommit:
name: Create Release Commit (${{ inputs.version }})
runs-on: ubuntu-latest
env:
UPDATE_FILES: ${{ inputs.update_files }}
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
steps:
- name: Get Token
id: token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ secrets.APP_ID }}
application_private_key: ${{ secrets.APP_KEY }}
organization: Nomi-CEu
revoke_token: true
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.token.outputs.token }}
- name: Restore Cached Files
uses: actions/cache@v4
id: cache
with:
path: |
~/.npm
./.cache
./tools/node_modules
key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }}
restore-keys: ${{ runner.os }}-bunny-
- name: Setup NodeJS v16
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- name: Setup NPM Packages
working-directory: ./tools
run: npm ci
- name: Check Environmental Variables
working-directory: ./tools
run: npx gulp check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
- name: Update Files
working-directory: ./tools
run: npx gulp updateFilesAll
- name: Commit and Push Release Changes
uses: stefanzweifel/git-auto-commit-action@v5
id: commit-release
if: ${{ !inputs.update_files }}
with:
commit_message: "${{ inputs.release_type }} ${{ inputs.tag }}\n\n[NO CATEGORY]"
commit_author: nomi-ceu-management[bot] <155502507+nomi-ceu-management[bot]@users.noreply.github.com>
commit_user_name: nomi-ceu-management[bot]
commit_user_email: 155502507+nomi-ceu-management[bot]@users.noreply.github.com
tagging_message: "${{ inputs.tag }}"
- name: Commit and Push Update Changes
uses: stefanzweifel/git-auto-commit-action@v5
id: commit-update
if: ${{ inputs.update_files }}
with:
commit_message: "Update Issue, Server and RP Config Files from Templates\n\n[SKIP]"
commit_author: nomi-ceu-management[bot] <155502507+nomi-ceu-management[bot]@users.noreply.github.com>
commit_user_name: nomi-ceu-management[bot]
commit_user_email: 155502507+nomi-ceu-management[bot]@users.noreply.github.com
- name: Throw Error if No Changes were Detected
if: ${{ steps.commit-release.outputs.changes_detected == 'false' || steps.commit-update.outputs.changes_detected == 'false' }}
run: |
echo "No Changes were Detected. Most likely, this is an error."
exit 1