Skip to content

Commit

Permalink
Workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Jun 29, 2024
1 parent 690f3d9 commit 09d839d
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [ published ]

env:
package_id: item-piles

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -63,6 +66,44 @@ jobs:
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}

- name: Get Compatibility
if: "!github.event.release.prerelease"
run: |
echo 'COMPATIBILITY<<EOF' >> $GITHUB_ENV
cat module.json | jq .compatibility >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Send package to foundry
if: "!github.event.release.prerelease"
run: |
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST 'https://api.foundryvtt.com/_api/packages/release_version/' \
--header 'Authorization: ${{ secrets.PACKAGE_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{
"id": "${{env.package_id}}",
"release": {
"version": "${{ github.event.release.tag_name }}",
"manifest": "https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.json",
"notes": "https://github.com/${{github.repository}}/releases/tag/${{github.event.release.tag_name}}",
"compatibility": ${{ env.COMPATIBILITY }}
}
}')
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
# print the body
echo "$HTTP_BODY"
# example using the status
if [ ! $HTTP_STATUS -eq 200 ]; then
echo "Error [HTTP status: $HTTP_STATUS]"
exit 1
fi
# OR create a pre-release for this specific version
- name: Update Release with Files
if: "github.event.release.prerelease"
Expand Down

0 comments on commit 09d839d

Please sign in to comment.