Revert "Fix: declaring UtilsJS again" (#548) #890
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-release Pipeline | |
concurrency: pre-release-pipeline | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- modpack-update-checker/** | |
- java/** | |
env: | |
pack-file: "pack.toml" | |
name: 'Create: Prepare to Dye' | |
slug: 'create-prepare-to-dye' | |
modrinth-url: 'https://modrinth.com/modpack/create-prepare-to-dye' | |
loader: 'forge' | |
mc_version: '1.19.2' | |
jobs: | |
check_rank: | |
needs: [tag_and_release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
limit=100 | |
offset=0 | |
totalItems=1000 | |
while [ $offset -lt $totalItems ]; do | |
curl --silent "https://api.modrinth.com/v2/search?limit=$limit&offset=$offset&facets=%5B%5B%22project_type%3Amodpack%22%5D%5D" | \ | |
jq '.hits | to_entries[] | "\(.key + $offset): \(.value.title)"' --argjson offset $offset | grep "${{env.name}}" | sed 's/:.*//' | tr -d '"' >> rank | |
offset=$((offset + limit)) | |
done | |
old_rank=$(cat README.md | grep -o 'Modrint%20Rank-[0-9]*' | sed 's/Modrint%20Rank-//') | |
new_rank=$(cat rank) | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: validate JSON and YAML files | |
uses: GrantBirki/json-yaml-validate@v2.4.0 | |
tag_and_release: | |
runs-on: ubuntu-latest | |
outputs: | |
new_tag: ${{ steps.tag_version.outputs.new_tag }} | |
changelog: ${{ steps.tag_version.outputs.changelog }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
tag_prefix: '' | |
custom_release_rules: "dev:patch:Developer experience improvments and changes,tweak:patch:Minor tweaks,feat:minor:Features,fix:patch:Fixes,revert:patch:Reverted Changes,docs:patch:Documentation and Localization,test:patch:Tests and testing related changes,mods:patch:Modlist related changes,ci:patch:Continuous Integration" | |
github_token: ${{ secrets.GH_TOKEN }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
token: ${{ secrets.GH_TOKEN }} | |
prerelease: true | |
release: | |
needs: [tag_and_release, tests] | |
strategy: | |
matrix: | |
include: | |
- platform: modrinth | |
file_suffix: mrpack | |
- platform: curseforge | |
file_suffix: zip | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install packwiz | |
uses: supplypike/setup-bin@v3 | |
with: | |
uri: "https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip" | |
name: "packwiz" | |
version: "linux" | |
- name: Build args | |
id: build_args | |
run: echo 'name=${{ needs.tag_and_release.outputs.new_tag }}-${{ env.slug }} [forge][${{ matrix.platform }}]' >> $GITHUB_OUTPUT | |
# - name: Detect curseforge jars | |
# if: matrix.platform == 'curseforge' | |
# run: packwiz curseforge detect | |
- name: Get unix time | |
id: get_time | |
run: echo "time=$(date +%s%3N)" >> $GITHUB_OUTPUT | |
- name: Update changelog files | |
run: | | |
cd modpack-update-checker | |
echo $(jq -r '.versions[.versions| length] |= . + {"id":"${{ needs.tag_and_release.outputs.new_tag }}","releasedAt":${{ steps.get_time.outputs.time }}}' meta.json) > meta.json | |
mkdir versions/${{ needs.tag_and_release.outputs.new_tag }} | |
echo "${{ needs.tag_and_release.outputs.changelog }}" > versions/${{ needs.tag_and_release.outputs.new_tag }}/changelog.txt | |
cd ../config | |
echo $(jq -r '.currentVersion = "${{ needs.tag_and_release.outputs.new_tag }}"' modpack-update-checker/config.json) > modpack-update-checker/config.json | |
- name: Update discord presense text | |
run: | | |
cd kubejs/assets/sdrp/lang | |
json=$(jq '."sdrp.logo"="Hanging out with Betsy on version ${{ needs.tag_and_release.outputs.new_tag }}"' en_us.json) | |
echo $json > en_us.json | |
- name: Move to curseforge folder and take some folders with me | |
if: matrix.platform == 'curseforge' | |
run: | | |
cd curseforge | |
cp -R ../config ../defaultconfigs ../fancymenu_data ../kubejs ../modpack-update-checker ../discord-mark-blue.png ../discord-mark-white.png . | |
- name: Build Modpack modrinth | |
if : matrix.platform == 'modrinth' | |
run: packwiz ${{ matrix.platform }} export --output "${{ steps.build_args.outputs.name }}.${{ matrix.file_suffix }}" | |
- name: Build Modpack curseforge | |
if : matrix.platform == 'curseforge' | |
run: | | |
cd curseforge | |
packwiz ${{ matrix.platform }} export --output "${{ steps.build_args.outputs.name }}.${{ matrix.file_suffix }}" | |
cp *.zip ../ | |
- name: Upload Modpack file to GitHub Releases | |
run: | | |
gh release upload ${{ needs.tag_and_release.outputs.new_tag }} *.${{ matrix.file_suffix }} \ | |
--repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \ | |
--clobber | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Publish to Modrinth | |
if: matrix.platform == 'modrinth' | |
uses: Kir-Antipov/mc-publish@v3.3.0 | |
with: | |
modrinth-id: ${{ vars.MODRINTH_ID }} | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
loaders: ${{ env.loader}} | |
game-versions: ${{ env.mc_version}} | |
changelog: ${{ needs.tag_and_release.outputs.changelog }} | |
files: "*.mrpack" | |
version: ${{ needs.tag_and_release.outputs.new_tag }} | |
version-type: beta | |
name: ${{ steps.build_args.outputs.name }} | |
- name: Update modrinth description to match reademe | |
if: matrix.platform == 'modrinth' | |
run: | | |
curl -X PATCH \ | |
-H "Authorization: ${{ secrets.MODRINTH_TOKEN }}" \ | |
-H "Content-Type: application/json" \ | |
-d "$(cat README.md | jq -R -s '{body: .}')" \ | |
https://api.modrinth.com/v2/project/${{ vars.MODRINTH_ID }} | |
- name: Pull | |
if: matrix.platform == 'modrinth' | |
run: git pull | |
- name: Commit & Push changes | |
if: matrix.platform == 'modrinth' | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
- name: Publish to CurseForge | |
if: matrix.platform == 'curseforge' | |
uses: Kir-Antipov/mc-publish@v3.3.0 | |
with: | |
curseforge-id: ${{ vars.CF_ID }} | |
curseforge-token: ${{ secrets.CF_API_TOKEN }} | |
loaders: forge | |
game-versions: 1.19.2 | |
changelog: ${{ needs.tag_and_release.outputs.changelog }} | |
files: "*.zip" | |
version: ${{ needs.tag_and_release.outputs.new_tag }} | |
version-type: release | |
name: ${{ steps.build_args.outputs.name }} | |
curseforge-version: ${{ needs.tag_and_release.outputs.new_tag }} |