modded7/.github/workflows/createchangelog.yml
2024-01-03 21:37:32 +11:00

129 lines
3.8 KiB
YAML

name: Create Changelog
on:
workflow_dispatch:
inputs:
tag:
description: Tag to checkout.
required: false
release_type:
description: Release Type
type: choice
required: true
default: 'Release'
options:
- 'Release'
- 'Beta Release'
- 'Alpha Release'
- 'Cutting Edge Build'
compare_tag:
description: Tag(s) to compare against. If not set, will use the tag before `Tag`. If specifying multiple, seperate by commas. (Spaces allowed).
required: false
branch:
description: Branch to push changelog to. If not set, changelog will just be uploaded as an artifact.
required: false
test:
description: Whether to test commits. If true, then any parsing errors will throw an error.
required: false
type: boolean
default: false
workflow_call:
inputs:
tag:
description: Tag to make changelog at.
type: string
required: false
release_type:
description: Release Type.
type: string
required: true
compare_tag:
description: Tag to compare against.
type: string
required: false
branch:
description: Branch to push changelog to. If not set, will not push. Will still be uploaded as artifact.
type: string
required: false
test:
description: Whether to test commits. If true, then any parsing errors will throw an error.
required: false
type: boolean
default: false
jobs:
deploy:
name: Create Changelog (${{ inputs.tag }})
runs-on: ubuntu-latest
env:
GITHUB_TAG: ${{ inputs.tag }}
RELEASE_TYPE: ${{ inputs.release_type }}
steps:
- name: Get Token
id: token
uses: peter-murray/workflow-application-token-action@v2.1.0
with:
application_id: ${{ secrets.APP_ID }}
application_private_key: ${{ secrets.APP_KEY }}
organization: Nomi-CEu
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}
token: ${{ steps.token.outputs.token }}
- name: Restore Cached Files
uses: actions/cache@v3
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@v3
with:
node-version: "16"
check-latest: true
- name: Setup NPM Packages
working-directory: ./tools
run: npm ci
- name: Create Changelog
working-directory: ./tools
run: npx gulp createChangelog
env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }}
COMPARE_TAG: ${{ inputs.compare_tag }}
TEST_CHANGELOG: ${{ inputs.test }}
- name: Commit and Push Changelog
if: ${{ inputs.branch }}
uses: "stefanzweifel/git-auto-commit-action@v4"
id: "commit-template"
with:
commit_message: "Upload Changelogs for Release ${{ inputs.tag }}"
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
branch: ${{ inputs.branch }}
create_branch: true
- name: Upload Changelog
uses: actions/upload-artifact@v3
with:
name: Changelogs
path: |
./CHANGELOG.md
./CHANGELOG_CF.md
if-no-files-found: error