Skip to content

Commit

Permalink
Workflow Separation (#2300)
Browse files Browse the repository at this point in the history
  • Loading branch information
krossgg authored Nov 10, 2024
1 parent 70aa509 commit 7ba5b0f
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 16 deletions.
45 changes: 45 additions & 0 deletions .github/json/config-1.21.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"categories": [
{
"title": "### Added",
"labels": ["type: feature"]
},
{
"title": "### Fixed",
"labels": ["type: bugfix"]
},
{
"title": "### Changed",
"labels": ["type: refactor", "type: translation"]
}
],
"sort": "ASC",
"template": "## Version [v#{{VERSION}}](#{{RELEASE_DIFF}})\n#{{CHANGELOG}} ",
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})",
"custom_placeholders": [
{
"name": "VERSION",
"source": "TO_TAG",
"transformer": {
"pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?",
"target": "$1"
}
}
],
"empty_template": "",
"ignore_labels": ["ignore changelog"],
"tag_resolver": {
"method": "semver",
"filter": {
"pattern": "^(?!v?[0-9\\.]+(-1\\.21)$).+$",
"flags": "gu"
},
"transformer": {
"pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?",
"target": "$1"
}
},
"max_pull_requests": 1000,
"max_back_track_time_days": 90,
"base_branches": ["1.21"]
}
5 changes: 3 additions & 2 deletions .github/json/config-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
}
],
"sort": "ASC",
"template": "## What's Changed\n#{{CHANGELOG}}",
"template": "## What's Changed\n#{{CHANGELOG}}\n#{{UNCATEGORIZED}}",
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})",
"empty_template": "",
"ignore_labels": ["ignore changelog"],
"max_pull_requests": 1000,
"max_back_track_time_days": 90
"max_back_track_time_days": 30
}
20 changes: 15 additions & 5 deletions .github/json/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,29 @@
}
],
"sort": "ASC",
"template": "## Version [#{{TO_TAG}}](#{{RELEASE_DIFF}})\n#{{CHANGELOG}} ",
"template": "## Version [v#{{VERSION}}](#{{RELEASE_DIFF}})\n#{{CHANGELOG}} ",
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})",
"empty_template": "- No changes",
"custom_placeholders": [
{
"name": "VERSION",
"source": "TO_TAG",
"transformer": {
"pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?",
"target": "$1"
}
}
],
"empty_template": "",
"ignore_labels": ["ignore changelog"],
"tag_resolver": {
"method": "semver",
"filter": {
"pattern": "^(?!v?(1\\.20\\.1-)?[0-9\\.]+$).+$",
"pattern": "^(?!v?[0-9\\.]+(-1\\.20\\.1)?$).+$",
"flags": "gu"
},
"transformer": {
"pattern": "v?([0-9\\.]+-)?([0-9\\.]+)",
"target": "$2"
"pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?",
"target": "$1"
}
},
"max_pull_requests": 1000,
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/manage-pr-labels.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Manages labels on PRs before allowing merging
name: Pull Request Labels

# Checks for label once PR has been reviewed
# Checks for label once PR has been reviewed or label is applied
on:
pull_request_review:
types: [submitted]
pull_request:
types: [labeled]

concurrency:
group: pr-labels-${{ github.head_ref }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
release:
types: [released]

# TODO: Make it so you can publish releases for each mc-ver individually

jobs:
meta:
name: Metadata
Expand All @@ -25,17 +23,18 @@ jobs:
id: changelog
env:
GITHUB_TOKEN: ${{ github.token }}
CONFIG: ${{ contains(github.ref_name, '1.21') && '-1.21' || '' }}
uses: mikepenz/release-changelog-builder-action@v5
with:
configuration: ./.github/json/config.json
toTag: ${{ github.event.release.tag }}
configuration: './.github/json/config${{ env.CONFIG }}.json'
ignorePreReleases: true
fetchViaCommits: true
failOnError: true

publish-20:
name: 1.20.1
needs: [ meta ]
if: ${{ contains(github.ref_name, '1.20.1') || !contains(github.ref_name, '1.21') }}
secrets: inherit
uses: ./.github/workflows/publish.yml
with:
Expand All @@ -48,6 +47,7 @@ jobs:
publish-21:
name: 1.21.1
needs: [ meta ]
if: ${{ contains(github.ref_name, '1.21') || !contains(github.ref_name, '1.20.1') }}
secrets: inherit
uses: ./.github/workflows/publish.yml
with:
Expand Down
40 changes: 36 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
files: ./*.jar
fail_on_unmatched_files: true

publish-cf-modrinth:
name: Publish Mod
publish-modrinth:
name: Publish to Modrinth
needs: build
if: ${{ !inputs.simulate }}
runs-on: ubuntu-latest
Expand All @@ -93,18 +93,50 @@ jobs:
MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }}
LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }}
JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }}
VERSION_TYPE: ${{ inputs.branch == '1.21' && 'alpha' || 'beta' }}
uses: Kir-Antipov/[email protected]
with:
modrinth-id: 7tG215v7
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
files: |
./gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar
./!(gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar)
name: 'GregTechCEu ${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}'
version: 'mc${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}'
version-type: ${{ env.VERSION_TYPE }}
changelog: ${{ inputs.release-body }}
loaders: ${{ env.LOADER }}
java: ${{ env.JAVA }}
fail-mode: fail

publish-cf:
name: Publish to CF
needs: build
if: ${{ !inputs.simulate }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ inputs.branch }}
- name: Publish Mod
env:
MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }}
LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }}
JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }}
VERSION_TYPE: ${{ inputs.branch == '1.21' && 'alpha' || 'beta' }}
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 890405
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
files: |
./gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar
./!(gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar)
name: 'GregTechCEu ${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}'
version: 'mc${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}'
version-type: beta
version-type: ${{ env.VERSION_TYPE }}
changelog: ${{ inputs.release-body }}
loaders: ${{ env.LOADER }}
java: ${{ env.JAVA }}
Expand All @@ -113,7 +145,7 @@ jobs:
# After successful release, PR version bump and changelog
bump-version-and-changelog:
name: Bump Version and Build Changelog
needs: [ build, upload-release-artifacts, publish-cf-modrinth ]
needs: [ build, upload-release-artifacts, publish-modrinth, publish-cf]
if: ${{ always() && !failure() && !cancelled() }}
runs-on: ubuntu-latest
permissions:
Expand Down

0 comments on commit 7ba5b0f

Please sign in to comment.