|
| 1 | +name: Manual Build and Changelog |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + vars: |
| 8 | + name: Gather Variables |
| 9 | + runs-on: ubuntu-20.04 |
| 10 | + outputs: |
| 11 | + release_type: ${{steps.cf_release_type.outputs.value }} |
| 12 | + cf_project: ${{steps.cf_project.outputs.value }} |
| 13 | + mod_id: ${{steps.mod_id.outputs.value }} |
| 14 | + version: ${{steps.version.outputs.version }} |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Unshallow |
| 21 | + run: git fetch --prune --unshallow |
| 22 | + |
| 23 | + - name: Release Type |
| 24 | + id: cf_release_type |
| 25 | + uses: christian-draeger/read-properties@1.0.1 |
| 26 | + with: |
| 27 | + path: './gradle.properties' |
| 28 | + property: 'cf_release_type' |
| 29 | + |
| 30 | + - name: Project ID |
| 31 | + id: cf_project |
| 32 | + uses: christian-draeger/read-properties@1.0.1 |
| 33 | + with: |
| 34 | + path: './gradle.properties' |
| 35 | + property: 'cf_project' |
| 36 | + |
| 37 | + - name: Mod ID |
| 38 | + id: mod_id |
| 39 | + uses: christian-draeger/read-properties@1.0.1 |
| 40 | + with: |
| 41 | + path: './gradle.properties' |
| 42 | + property: 'mod_id' |
| 43 | + |
| 44 | + - name: Find Current Tag |
| 45 | + id: current |
| 46 | + uses: jimschubert/query-tag-action@v1 |
| 47 | + with: |
| 48 | + include: 'v*' |
| 49 | + exclude: '*-rc*' |
| 50 | + commit-ish: '@' |
| 51 | + skip-unshallow: 'true' |
| 52 | + |
| 53 | + - name: Semver Version |
| 54 | + id: version |
| 55 | + run: | |
| 56 | + version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2) |
| 57 | + echo "::set-output name=version::$version" |
| 58 | +
|
| 59 | + changelog: |
| 60 | + name: Generate Changelog (tags) |
| 61 | + runs-on: ubuntu-20.04 |
| 62 | + steps: |
| 63 | + - name: Checkout |
| 64 | + uses: actions/checkout@v2 |
| 65 | + |
| 66 | + - name: Unshallow |
| 67 | + run: git fetch --prune --unshallow |
| 68 | + |
| 69 | + - name: Find Current Tag |
| 70 | + id: current |
| 71 | + uses: jimschubert/query-tag-action@v1 |
| 72 | + with: |
| 73 | + include: 'v*' |
| 74 | + exclude: '*-rc*' |
| 75 | + commit-ish: '@' |
| 76 | + skip-unshallow: 'true' |
| 77 | + |
| 78 | + - name: Previous Tag |
| 79 | + id: last |
| 80 | + uses: jimschubert/query-tag-action@v1 |
| 81 | + with: |
| 82 | + include: 'v*' |
| 83 | + exclude: ${{steps.current.outputs.tag}} |
| 84 | + skip-unshallow: 'true' |
| 85 | + |
| 86 | + - name: Generate changelog |
| 87 | + uses: jimschubert/beast-changelog-action@v1 |
| 88 | + with: |
| 89 | + GITHUB_TOKEN: ${{github.token}} |
| 90 | + CONFIG_LOCATION: .github/changelog.json |
| 91 | + FROM: ${{steps.last.outputs.tag}} |
| 92 | + TO: ${{steps.current.outputs.tag}} |
| 93 | + OUTPUT: .github/CHANGELOG.md |
| 94 | + |
| 95 | + - name: Read CHANGELOG file |
| 96 | + id: getchangelog |
| 97 | + run: echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)" |
| 98 | + |
| 99 | + - name: View Changelog |
| 100 | + run: cat .github/CHANGELOG.md |
| 101 | + |
| 102 | + - name: Add Artifact |
| 103 | + uses: actions/upload-artifact@v2 |
| 104 | + with: |
| 105 | + name: out |
| 106 | + path: .github/CHANGELOG.md |
| 107 | + |
| 108 | + jar: |
| 109 | + name: Create JAR |
| 110 | + runs-on: ubuntu-20.04 |
| 111 | + needs: [vars, changelog] |
| 112 | + steps: |
| 113 | + - name: Download Changelog Results |
| 114 | + uses: actions/download-artifact@v2 |
| 115 | + with: |
| 116 | + name: out |
| 117 | + path: changelog |
| 118 | + |
| 119 | + - name: Checkout |
| 120 | + uses: actions/checkout@v2 |
| 121 | + |
| 122 | + - name: Unshallow |
| 123 | + run: git fetch --prune --unshallow |
| 124 | + |
| 125 | + - name: Set up JDK |
| 126 | + uses: actions/setup-java@v2 |
| 127 | + with: |
| 128 | + distribution: 'temurin' |
| 129 | + java-version: "17" |
| 130 | + |
| 131 | + - name: Grant execute permission for gradlew |
| 132 | + run: chmod +x gradlew |
| 133 | + |
| 134 | + - name: Data-generated assets |
| 135 | + run: ./gradlew runData |
| 136 | + env: |
| 137 | + CM_RELEASE: true |
| 138 | + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} |
| 139 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 140 | + |
| 141 | + - name: Build JAR with Gradle |
| 142 | + run: ./gradlew build |
| 143 | + env: |
| 144 | + CM_RELEASE: true |
| 145 | + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} |
| 146 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 147 | + |
| 148 | + - name: Output Dir Structure |
| 149 | + run: ls -lhR build-out |
| 150 | + |
| 151 | + - name: Add Artifact |
| 152 | + uses: actions/upload-artifact@v2 |
| 153 | + with: |
| 154 | + name: libs |
| 155 | + path: | |
| 156 | + build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar |
| 157 | + build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar |
| 158 | +
|
| 159 | + view: |
| 160 | + name: View Changelog Output |
| 161 | + runs-on: ubuntu-20.04 |
| 162 | + needs: [changelog] |
| 163 | + steps: |
| 164 | + - name: Download Build Results |
| 165 | + uses: actions/download-artifact@v2 |
| 166 | + with: |
| 167 | + name: out |
| 168 | + path: changelog |
| 169 | + - run: cat changelog/CHANGELOG.md |
0 commit comments