Build #56 #56
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: Build | |
run-name: "Build #${{ github.run_number }}" | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
modpack-info: | |
name: Modpack Info | |
runs-on: ubuntu-latest | |
outputs: | |
project_name: ${{ steps.info.outputs.project_name }} | |
project_version: ${{ steps.info.outputs.project_version }} | |
mcversion: ${{ steps.info.outputs.mcversion }} | |
tag: ${{ steps.version.outputs.tag }} | |
news: ${{ steps.changelog.outputs.news }} | |
changelog: ${{ steps.changelog_full.outputs.description }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Get tag | |
id: version | |
uses: "WyriHaximus/[email protected]" | |
with: | |
fallback: tag_not_found | |
- name: Modpack info | |
id: info | |
shell: bash | |
run: | | |
set +e | |
if [ ! -f ./.github/buildtools/modpack/manifest.json ]; then | |
echo "::error::Could not find manifest.json" && exit 1 | |
fi | |
manifestjson=`cat ./.github/buildtools/modpack/manifest.json` | |
project_name=`echo $(jq -r '.name' <<< "$manifestjson")` | |
echo "project_name=$project_name" >> $GITHUB_OUTPUT | |
mcversion=`echo $(jq -r '.minecraft.version' <<< "$manifestjson")` | |
echo "mcversion=$mcversion" >> $GITHUB_OUTPUT | |
if [[ ${{ startsWith(github.ref, 'refs/tags/') }} == true ]]; then | |
echo "project_version=${{ steps.version.outputs.tag }}" >> $GITHUB_OUTPUT | |
else | |
echo "project_version=build.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Changelog Parser | |
id: changelog_full | |
uses: coditory/[email protected] | |
with: | |
path: CHANGELOG.md | |
- name: Create Discord message | |
id: message | |
shell: bash | |
run: | | |
header="## **${{ steps.info.outputs.project_name }}** был обновлен до ${{ steps.info.outputs.project_version }}! :tada:" | |
echo -e "header=$header" >> $GITHUB_OUTPUT | |
link+="[CurseForge](<https://www.curseforge.com/minecraft/modpacks/terrafirmagreg/files/5009295>) • " | |
link+="[GitHub](<https://github.com/TerraFirmaGreg-Team/TFG-Modpack-1.20.x/releases/tag/0.4.0>) • " | |
link+="[Issues](<https://github.com/TerraFirmaGreg-Team/TFG-Modpack-1.20.x/issues>)" | |
echo -e "link=$link" >> $GITHUB_OUTPUT | |
news=$(echo -e "${{ steps.changelog_full.outputs.description }}" | sed -n '/### Изменения/,/###/p' | sed '$d') | |
printf "%s\n" "news=$news" >> $GITHUB_OUTPUT | |
- name: Send Discord message | |
uses: hugoalh/[email protected] | |
with: | |
key: "${{secrets.RELEASES_1_20}}" | |
username: "TerraFirmaGreg" | |
avatar_url: "https://raw.githubusercontent.com/TerraFirmaGreg-Team/.github/main/branding/logo_new_year.png" | |
content: "${{ steps.message.outputs.header }}\n${{ steps.message.outputs.link }}\n${{ steps.message.outputs.news }}" | |
# build-cf-modpack: | |
# name: Build CF Modpack | |
# runs-on: ubuntu-latest | |
# needs: [modpack-info] | |
# steps: | |
# - name: Checkout | |
# uses: actions/[email protected] | |
# - name: Replace strings | |
# shell: bash | |
# run: | | |
# VERSION=${{ needs.modpack-info.outputs.project_version }} | |
# sed -i -e "s/DEV/${VERSION}/g" .github/buildtools/modpack/manifest.json | |
# sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/main_menu.txt | |
# sed -i -e "s/DEV/${VERSION}/g" config/bcc-common.toml | |
# - name: Export CF | |
# run: | | |
# mkdir -p overrides | |
# mv -vf {config,defaultconfigs,kubejs} overrides/ | |
# mv -vf .github/buildtools/modpack/manifest.json ./ | |
# mv -vf .github/buildtools/modpack/modlist.html ./ | |
# zip -r ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-cf.zip manifest.json modlist.html overrides | |
# - name: Upload zip cf | |
# uses: actions/[email protected] | |
# with: | |
# name: ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-cf | |
# path: ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-cf.zip | |
# retention-days: 5 | |
# build-mmc-modpack: | |
# name: Build MMC Modpack | |
# runs-on: ubuntu-latest | |
# needs: [modpack-info] | |
# steps: | |
# - name: Checkout | |
# uses: actions/[email protected] | |
# - name: Replace strings | |
# shell: bash | |
# run: | | |
# VERSION=${{ needs.modpack-info.outputs.project_version }} | |
# sed -i -e "s/DEV/${VERSION}/g" .github/buildtools/modpack/instance.cfg | |
# sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/main_menu.txt | |
# sed -i -e "s/DEV/${VERSION}/g" config/bcc-common.toml | |
# - name: Download Mods | |
# run: | | |
# git submodule init | |
# cd mods | |
# git config --global credential.helper '!f() { | |
# echo "username=Xikaro"; | |
# echo "password=${{ secrets.USER_TOKEN_XIKARO }}"; }; f' | |
# git submodule update --recursive | |
# - name: Export MMC | |
# run: | | |
# mkdir -p .minecraft | |
# mv -vf {config,defaultconfigs,kubejs,mods} .minecraft/ | |
# mv -vf .github/buildtools/modpack/mmc-pack.json ./ | |
# mv -vf .github/buildtools/modpack/instance.cfg ./ | |
# zip -r ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-mmc.zip mmc-pack.json instance.cfg .minecraft/ | |
# - name: Upload zip mmc | |
# uses: actions/[email protected] | |
# with: | |
# name: ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-mmc | |
# path: ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-mmc.zip | |
# retention-days: 5 | |
# build-serverpack: | |
# name: Build Serverpack | |
# runs-on: ubuntu-latest | |
# needs: [modpack-info] | |
# steps: | |
# - name: Checkout | |
# uses: actions/[email protected] | |
# - name: Replace strings | |
# shell: bash | |
# run: | | |
# VERSION=${{ needs.modpack-info.outputs.project_version }} | |
# sed -i -e "s/DEV/${VERSION}/g" config/bcc-common.toml | |
# - name: Download Mods | |
# run: | | |
# git submodule init | |
# cd mods | |
# git config --global credential.helper '!f() { | |
# echo "username=Xikaro"; | |
# echo "password=${{ secrets.USER_TOKEN_XIKARO }}"; }; f' | |
# git submodule update --recursive | |
# - name: Export serverpack | |
# run: | | |
# mkdir -p .minecraft | |
# mv -vf {config,defaultconfigs,kubejs,mods,.github/buildtools/serverpack/*} .minecraft | |
# cat .github/buildtools/client_mod.txt | while read -r line; do find .minecraft/mods -name "$line" -delete; done | |
# zip -r ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-server.zip .minecraft/* | |
# - name: Upload zip | |
# uses: actions/[email protected] | |
# with: | |
# name: ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-server | |
# path: ${{ needs.modpack-info.outputs.project_name }}-${{ needs.modpack-info.outputs.project_version }}-server.zip | |
# retention-days: 5 | |
# release: | |
# name: Release | |
# needs: [modpack-info, build-cf-modpack, build-mmc-modpack, build-serverpack] | |
# if: startsWith(github.ref, 'refs/tags/') | |
# uses: ./.github/workflows/release.yml | |
# with: | |
# project_name: ${{ needs.modpack-info.outputs.project_name }} | |
# project_version: ${{ needs.modpack-info.outputs.project_version }} | |
# mcversion: ${{ needs.modpack-info.outputs.mcversion }} | |
# tag: ${{ needs.modpack-info.outputs.tag }} | |
# news: ${{ needs.modpack-info.outputs.news }} | |
# changelog: ${{ needs.modpack-info.outputs.changelog }} | |
# secrets: inherit | |