name: Create Release Commit on: workflow_dispatch: inputs: version: description: | Release Version (aka 1.6.1a, 1.6.1-beta-3, 2.0, etc.). Still important if not a release, and will be used to replace all version fields. required: true release_type: description: 'Release Type. Will be ignored if not a release.' type: choice required: true default: 'Release' options: - 'Release' - 'Beta Release' - 'Alpha Release' is_release: description: | Whether this commit is a release. Usually, leave this set to true. See CONTRIBUTING.md for more details. type: boolean required: true default: true workflow_call: inputs: version: description: | Release Version (aka 1.6.1a, 1.6.1-beta-3, 2.0, etc.). Still important if not a release, and will be used to replace all version fields. type: string required: true release_type: description: 'Release Type. Will be ignored if not a release.' type: string required: true is_release: description: | Whether this commit is a release. See CONTRIBUTING.md for more details. type: boolean required: false default: true jobs: # Release Commit Steps createReleaseCommit: name: Create Release Commit (${{ inputs.version }}) runs-on: ubuntu-latest if: "${{ inputs.is_release }}" env: VERSION: "${{ inputs.version }}" RELEASE_TYPE: "${{ inputs.release_type }}" permissions: contents: write steps: - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - 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: 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: Set Release Version working-directory: ./tools run: | npx gulp addVersionAll - name: Commit and Push Release Changes uses: "stefanzweifel/git-auto-commit-action@v4" id: "commit-release" with: commit_message: "${{ inputs.release_type }} ${{ inputs.version }}\n\n[NO CATEGORY]" commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" tagging_message: "${{ inputs.version }}" - name: Throw Error if No Release Changes were Detected if: ${{ steps.commit-release.outputs.changes_detected == 'false' }} run: | echo "No Changes were Made." exit 1 # Non-Release Commit Steps updateFilesFromTemplate: name: Update Files from Templates runs-on: ubuntu-latest if: "${{ !inputs.is_release }}" env: VERSION: "${{ inputs.version }}" permissions: contents: write steps: - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - 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: 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 from Templates working-directory: ./tools run: | npx gulp updateTemplatesAll - name: Commit and Push Template Changes uses: "stefanzweifel/git-auto-commit-action@v4" id: "commit-template" with: commit_message: "Update Issue, Server and RP Config Files from Templates\n\n[SKIP]" commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - name: Throw Error if No Template Changes were Detected if: ${{ steps.commit-template.outputs.changes_detected == 'false' }} run: | echo "No Template Changes were detected. This may be an error." exit 1