diff --git a/.asset-template.json.hb b/.asset-template.json.hb new file mode 100644 index 00000000..74609543 --- /dev/null +++ b/.asset-template.json.hb @@ -0,0 +1,14 @@ +{ + "title": "godot-cpp-template", + "category": "2D Tools", + "category_id": "1", + "godot_version": "4.1", + "version_string": "{{ context.inputs.tag_name }}", + "cost": "MIT", + "download_provider": "Custom", + "download_commit": "https://github.com/godotengine/godot-cpp-template/releases/download/{{ context.inputs.tag_name }}/godot-cpp-template.zip", + "browse_url": "{{ context.repository.html_url }}", + "issues_url": "{{ context.repository.html_url }}/issues", + "download_url": "https://github.com/godotengine/godot-cpp-template/releases/download/{{ context.inputs.tag_name }}/godot-cpp-template.zip", + "icon_url": "https://raw.githubusercontent.com/godotengine/godot-cpp-template/main/example.png" +} \ No newline at end of file diff --git a/.github/workflows/make_build.yml b/.github/workflows/make_build.yml index 9e91738a..765ec4fb 100644 --- a/.github/workflows/make_build.yml +++ b/.github/workflows/make_build.yml @@ -1,9 +1,35 @@ # For syntax, see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax # This workflow is triggered manually on the "Actions" tab on GitHub, and can be used to create releases. -name: Make a GDExtension build for all supported platforms +name: Make and publish a GDExtension build for all supported platforms on: workflow_dispatch: + inputs: + release: + description: "Create a new GitHub release (Required to publish on Asset Lib)." + type: boolean + required: false + default: false + tag_name: + description: "Tag name" + required: false + default: "" + release_name: + description: "Release name" + required: false + default: "" + publish: + description: "Publish new version to asset lib (Requires ASSET_STORE_USERNAME and ASSET_STORE_PASSWORD secrets, and .asset-template.json.hb to be edited)." + type: boolean + required: false + default: false + asset_id: + description: "The asset ID" + required: false + default: "" + +permissions: + contents: write jobs: build: @@ -88,7 +114,7 @@ jobs: with: name: godot-cpp-template-${{ matrix.target.platform }}-${{ matrix.target.arch }}-${{ matrix.float-precision }}-${{ matrix.target-type }} path: | - ${{ github.workspace }}/bin/** + ${{ github.workspace }}/demo/bin/** # Merges all the build artifacts together into a single godot-cpp-template artifact. # If you comment out this step, all the builds will be uploaded individually. @@ -102,3 +128,47 @@ jobs: name: godot-cpp-template pattern: godot-cpp-template-* delete-merged: true + + # Create a GitHub release + release: + if: ${{ inputs.release}} + runs-on: ubuntu-22.04 + needs: merge + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download merged artifact + uses: actions/download-artifact@v4 + with: + name: godot-cpp-template + path: release/addons/godot-cpp-template/ + + - name: Create archive + shell: bash + run: | + sudo apt-get update && sudo apt-get install -y zip + cd release && zip -r ../godot-cpp-template.zip . + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ github.event.inputs.tag_name }} + name: ${{ github.event.inputs.release_name }} + body_path: CHANGELOG.md + make_latest: true + files: godot-cpp-template.zip + + publish: + if: ${{ inputs.publish && inputs.release }} + runs-on: ubuntu-22.04 + needs: release + steps: + - name: Publish new version to asset lib + uses: deep-entertainment/godot-asset-lib-action@v0.4.0 + with: + # https://docs.github.com/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets + username: ${{ secrets.ASSET_STORE_USERNAME }} + password: ${{ secrets.ASSET_STORE_PASSWORD }} + assetId: ${{ github.event.inputs.asset_id }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..39a5c904 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +# CHANGELOG.md \ No newline at end of file