From db8a7104fd6de9ffa94b3f02d3b18c202815bb9e Mon Sep 17 00:00:00 2001 From: fclante Date: Tue, 26 Mar 2024 22:01:37 +0100 Subject: [PATCH] Add script to pull modpack name prop for use with workflow --- .github/workflows/publish.yaml | 6 +++++- scripts/extract_modpack_name.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 scripts/extract_modpack_name.sh diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 9e385bf..2d3557b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -18,12 +18,16 @@ jobs: files: vanilla-plus/ dest: modpack.zip + - name: Get modpack name + id: get_modpack_name + run: scripts/extract_modpack_name.sh + - uses: GreenTF/upload-thunderstore-package@v4.2 with: namespace: Beeheim # the thunderstore 'team' to publish under description: ${{ github.event.release.body }} token: ${{ secrets.THUNDERSTORE_TOKEN }} - name: ${{ github.event.release.title }} # the name of the package + name: ${{ steps.get_modpack_name.outputs.Name }} # the name of the package version: ${{ github.ref_name }} # Use the tag as the package version community: Valheim # the game the package is for repo: valheim.thunderstore.io diff --git a/scripts/extract_modpack_name.sh b/scripts/extract_modpack_name.sh new file mode 100644 index 0000000..2fafe17 --- /dev/null +++ b/scripts/extract_modpack_name.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Check if a file path is provided +if [ $# -eq 0 ]; then + echo "No file path provided" + exit 1 +fi + +# Check if the file exists +if [ ! -f $1 ]; then + echo "File not found" + exit 1 +fi + +# Extract the name property +name=$(jq -r '.name' $1) +echo "$name" \ No newline at end of file