|
| 1 | +name: Publish release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "[0-9]+.[0-9]+.[0-9]+" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + fetch-core-libs: |
| 13 | + runs-on: ubuntu-22.04 |
| 14 | + env: |
| 15 | + CORE_LIB_REPO: tomwyr/godot-node-tree-core |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Resolve core lib version |
| 21 | + id: resolve-version |
| 22 | + run: scripts/resolve-core-lib-version.sh |
| 23 | + |
| 24 | + - name: Download core libs |
| 25 | + run: scripts/download-core-libs.sh |
| 26 | + env: |
| 27 | + CORE_LIB_VERSION: ${{ steps.resolve-version.outputs.core_lib_version }} |
| 28 | + TARGET_PLATFORMS: "macos linux windows" |
| 29 | + LIB_EXTENSIONS: ".dylib .so .dll" |
| 30 | + |
| 31 | + - name: Upload core libs artifacts |
| 32 | + uses: actions/upload-artifact@v4 |
| 33 | + with: |
| 34 | + name: core-libs |
| 35 | + path: core-libs |
| 36 | + |
| 37 | + run-tests: |
| 38 | + needs: fetch-core-libs |
| 39 | + runs-on: macos-14 |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout repository |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Download core libs artifacts |
| 46 | + uses: actions/download-artifact@v4 |
| 47 | + with: |
| 48 | + name: core-libs |
| 49 | + path: core-libs |
| 50 | + |
| 51 | + - name: Restore core libs |
| 52 | + run: scripts/restore-core-libs.sh |
| 53 | + |
| 54 | + - name: Set up JDK 21 |
| 55 | + uses: actions/setup-java@v4 |
| 56 | + with: |
| 57 | + java-version: '21' |
| 58 | + distribution: 'temurin' |
| 59 | + |
| 60 | + - name: Create properties from environment |
| 61 | + run: sh scripts/create-properties.sh |
| 62 | + |
| 63 | + - name: Setup Gradle |
| 64 | + uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 |
| 65 | + |
| 66 | + - name: Build with Gradle Wrapper |
| 67 | + run: ./gradlew test |
| 68 | + |
| 69 | + create-release: |
| 70 | + needs: run-tests |
| 71 | + runs-on: ubuntu-22.04 |
| 72 | + steps: |
| 73 | + - name: Download artifacts |
| 74 | + uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + path: core-libs |
| 77 | + merge-multiple: true |
| 78 | + |
| 79 | + - name: Get release id |
| 80 | + id: release-id |
| 81 | + run: | |
| 82 | + version=${{ github.ref_name }} |
| 83 | + date=$(date +'%Y-%m-%d') |
| 84 | + id=$(echo "$version - $data" | tr '.' -d | tr ' ' '-') |
| 85 | + echo "id=$id" >> $GITHUB_OUTPUT |
| 86 | +
|
| 87 | + - name: Create GitHub release |
| 88 | + uses: softprops/action-gh-release@v2 |
| 89 | + with: |
| 90 | + name: ${{ github.ref_name }} |
| 91 | + body: | |
| 92 | + [Changelog](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md#${{ steps.release-id.outputs.id }}) |
0 commit comments