Skip to content

1.0.2

1.0.2 #17

Workflow file for this run

name: Release
on:
release:
types: [published]
env:
package_type: module
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Modify manifest
run: |
sed -i.bak "s|latest|${{ github.event.release.name }}|g" module.json
rm module.json.bak
- name: Create zip file
run: zip -r ${{ env.package_type }}.zip . -x '*.git*'
- name: Create release
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
name: ${{ github.event.release.name }}
artifacts: './${{ env.package_type }}.json, ./${{ env.package_type }}.zip'
body: ${{ github.event.release.body }}
- name: Send package to foundry
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": "image-z00m",
"release": {
"version": "${{ github.event.release.name }}",
"manifest": "https://github.com/cussa/image-z00m/releases/download/${{ github.event.release.name }}/module.json",
"notes": "https://github.com/cussa/image-z00m/releases/tag/${{ github.event.release.name }}",
"compatibility": {
"minimum": "${{ vars.FOUNDRY_MINIMUM }}",
"verified": "${{ vars.FOUNDRY_VERIFIED }}",
"maximum": ""
}
}
}')
# 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