2.1.2 #26
Workflow file for this run
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: packwiz | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
info: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
outputs: | |
name: ${{ steps.info.outputs.name }} | |
version: ${{ steps.info.outputs.version }} | |
minecraft: ${{ steps.info.outputs.minecraft }} | |
sha: ${{ steps.info.outputs.sha }} | |
package: ${{ steps.info.outputs.package }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.18.0' | |
- name: Prepare environment | |
run: GO111MODULE=on go install github.com/freshautomations/stoml@latest | |
- name: Get info | |
id: info | |
run: | | |
name=`stoml pack.toml name` | |
echo "::set-output name=name::$name" | |
version=`stoml pack.toml version` | |
echo "::set-output name=version::$version" | |
minecraft=`stoml pack.toml versions.minecraft` | |
echo "::set-output name=minecraft::$minecraft" | |
sha=`echo $GITHUB_SHA | cut -c 1-7` | |
echo "::set-output name=sha::$sha" | |
package=${name}-${version} | |
echo "::set-output name=package::$package" | |
build: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [info] | |
env: | |
version: ${{ needs.info.outputs.version }} | |
sha: ${{ needs.info.outputs.sha }} | |
outputs: | |
package: ${{ steps.prepare.outputs.package }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.18.0' | |
- name: Download Packwiz | |
run: go install github.com/packwiz/packwiz@latest | |
- name: Prepare environment | |
run: | | |
touch index.toml | |
packwiz refresh | |
[ -d .output ] && rm -r .output | |
[ -d .temp ] && rm -r .temp | |
mkdir -p .output && mkdir -p .temp | |
- name: Prepare files | |
run: | | |
readonly files=( | |
./config/isxander-main-menu-credits.json | |
) | |
for file in "${files[@]}"; do | |
[[ ! -a "${file}" ]] && continue | |
echo "Replacing placeholders in ${file} file to data from environment" | |
eval "echo \"$(cat ${file} | sed -E 's/(["])/\\\1/g')\" > ${file}" 2> /dev/null | |
done | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Download Packwiz Installer | |
run: | | |
wget https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v0.0.3/packwiz-installer-bootstrap.jar \ | |
-O .temp/packwiz-installer-bootstrap.jar | |
- name: Export Modpack | |
run: | | |
packwiz modrinth export -o .output/${{ needs.info.outputs.package }}.mrpack | |
pack=file://`realpath pack.toml` | |
cd .temp && java -jar packwiz-installer-bootstrap.jar -g $pack | |
zip -r ../.output/${{ needs.info.outputs.package }}.zip . \ | |
-x 'packwiz-installer-bootstrap.jar' \ | |
-x 'packwiz-installer.jar' \ | |
-x 'packwiz.json' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Modpack | |
path: .output/ | |
release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [info, build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download modpack | |
uses: actions/download-artifact@v2 | |
with: | |
name: Modpack | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ needs.info.outputs.name }} ${{ needs.info.outputs.version }} for ${{ needs.info.outputs.minecraft }} | |
body_path: CHANGELOG.md | |
files: | | |
${{ needs.info.outputs.package }}.zip | |
${{ needs.info.outputs.package }}.mrpack | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Discord notification | |
uses: LeGitHubDeTai/github-to-discord@main | |
env: | |
DISCORD_USERNAME: "Quasar Update" | |
DISCORD_AVATAR: https://i.imgur.com/tFjuB4b.png | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
MESSAGE_TITLE: "${{ needs.info.outputs.name }} ${{ needs.info.outputs.version }} for ${{ needs.info.outputs.minecraft }} - " | |
MESSAGE_URL: "https://modrinth.com/modpack/quasar/version/${{ needs.info.outputs.version }}" | |
MESSAGE_DESCRIPTION: "**[Modrinth release page](https://modrinth.com/modpack/quasar/version/${{ needs.info.outputs.version }})**\n**[GitHub release page](https://github.com/Timoti11/quasar/releases/tag/v${{ needs.info.outputs.version }})**" | |
MESSAGE_COLOR: 5814783 | |
FOOTER_TEXT: "by Timoti11" | |
FOOTER_URL: "https://images-ext-1.discordapp.net/external/2qKhi2zHQrfW_hu5HrjxkoRiBRgT08j7_Bztf2ApK3o/https/images-ext-2.discordapp.net/external/ecsg1jR9KZEF5g3TyyULKF70ETmPbFItGSfLlHza-VY/https/images-ext-1.discordapp.net/external/zeQBIIqBNTESkGPblYjZotlN8057avDSRkzHxodm-mY/https/images-ext-2.discordapp.net/external/SN7CDY2oXhi8-7nwYsOYO29f-o40s-b3CDeV5r4v8Po/%2525253Fid%2525253D8aaa273f0fc1e97e%25252526scale%2525253D4/https/s.namemc.com/2d/skin/face.png" | |
AUTHOR_URL: "https://modrinth.com/modpack/quasar/version/${{ needs.info.outputs.version }}" | |
AUTHOR_NAME: "Скачать с Modrinth" | |
AUTHOR_AVATAR: "https://i.imgur.com/pEilWJt.png" | |
CONTENT: "<@&1090818585523388476>" |