Skip to content

Publish package

Publish package #59

Workflow file for this run

name: Publish package
on:
release:
types: [published] # run when a new release is published
tags:
- 'v*' # Trigger only if the tag matches eg. v1.0.0
workflow_run:
workflows: ["build"] # run if build.yml is successfully completed
types:
- completed
env:
name: ChebsNecromancy
jsonf: manifest.json
dlpath: https://github.com/jpw1991/chebs-necromancy/releases/download
dependencies: "[email protected]" # dependencies separated by spaces
categories: "Mods" # categories separated by spaces
namespace: ChebGonaz
jobs:
verify_manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check that version matches
run: |
version=$(grep -Po "<Version>([0-9]+\.[0-9]+\.[0-9]+.[0-9]+)<\/Version>" ${{env.name}}/${{env.name}}.csproj | sed -E 's/<\/?Version>//g; s/^([0-9]+\.[0-9]+\.[0-9]+).*$/\1/' )
versionfrommanifest="$(jq -r '.version_number' $(find ./${{env.name}}/Package -name ${{env.jsonf}}))"
[ -z "$version" ] && echo "::error::version is empty!" && exit 1
[ -z "$versionfrommanifest" ] && echo "::error::versionfrommanifest is empty!" && exit 1
if [[ $versionfrommanifest != $version ]]; then
echo "::error::Version in ${{env.jsonf}} does not match assembly version"
exit 1
fi
echo "VERSION=${version}" >> $GITHUB_ENV
- name: Get Description
id: get_description
run: |
description=$(jq -r '.description' $(find ./${{env.name}}/Package -name ${{env.jsonf}}))
echo "DESCRIPTION=${description}" >> $GITHUB_ENV
publish:
runs-on: ubuntu-latest
needs: verify_manifest
steps:
- uses: actions/checkout@v3
- run: wget ${{env.dlpath}}/v${{env.VERSION}}/${{env.name}}.${{env.VERSION}}.zip
- name: Upload Thunderstore Package
uses: GreenTF/upload-thunderstore-package@v4
with:
community: valheim
namespace: ${{env.namespace}}
name: ${{env.name}}
version: ${{env.VERSION}}
description: ${{env.DESCRIPTION}}
token: ${{secrets.TS_KEY}}
deps: ${{env.dependencies}}
categories: ${{env.categories}}
file: ${{env.name}}.${{env.VERSION}}.zip