name: Release Build on: push: branches: [main] paths-ignore: - "docs/**" - "*.md" - "NewHorizons/Schemas/**" - "LICENSE" - ".gitignore" pull_request: branches: [main] types: - synchronize - labeled paths-ignore: - "docs/**" - "*.md" - "NewHorizons/Schemas/**" - "LICENSE" - ".gitignore" jobs: Check_Version: name: Check Version if: ${{ contains(github.event.pull_request.labels.*.name, 'update-pr') }} runs-on: ubuntu-latest steps: - name: Checkout uses: "actions/checkout@v4" - name: Read Manifest id: read-manifest uses: notiz-dev/github-action-json-property@release with: path: "./NewHorizons/manifest.json" prop_path: "version" - name: Print version numbers run: | echo "Manifest version: $MANIFEST_VERSION" echo "PR version: $PR_VERSION" env: MANIFEST_VERSION: ${{ steps.read-manifest.outputs.prop }} PR_VERSION: ${{ github.event.pull_request.title }} - name: Error if: ${{ steps.read-manifest.outputs.prop != github.event.pull_request.title }} run: echo "::error file=manifest.json,title=Version Error::Hey DUMB-DUMB UPDATE THE MANIFEST VERSION" && exit 1 Build: needs: Check_Version if: ${{ needs.Check_Version.result == 'success' && (github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'update-pr')) }} uses: ./.github/workflows/build.yaml with: build_type: Release Update_Schemas: name: "Update Schemas" needs: Build if: ${{ needs.Build.outputs.schemas_changed == 'true' && github.ref == 'refs/heads/main' }} # Debug build will update schemas on push, so don't run if we're on pull request uses: ./.github/workflows/update_schemas.yml with: artifact_name: NewHorizons-Schemas-Release secrets: inherit Update_Release: name: "Create/Update Release Asset" needs: Build if: ${{ github.ref != 'refs/heads/main' && contains(github.event.pull_request.labels.*.name, 'update-pr') }} runs-on: ubuntu-latest steps: - name: Download Asset uses: actions/download-artifact@v4 with: name: xen.NewHorizons.Release path: xen.NewHorizons - name: Zip Asset run: | cd xen.NewHorizons/ zip -r xen.NewHorizons.zip * mv xen.NewHorizons.zip .. cd .. - name: Upload Asset uses: ncipollo/release-action@v1 with: allowUpdates: true commit: main tag: v${{ github.event.pull_request.title }} name: Version ${{ github.event.pull_request.title }} omitBodyDuringUpdate: true artifacts: "xen.NewHorizons.zip" draft: true prerelease: false