| # Workflow to build release artifacts |
| |
| name: release artifacts |
| |
| on: |
| release: |
| types: [ created ] |
| |
| jobs: |
| build-and-test: |
| |
| # The type of runner that the job will run on |
| runs-on: ubuntu-latest |
| |
| permissions: |
| contents: write |
| |
| steps: |
| - name: Setup Java 17 |
| uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 |
| with: |
| java-version: '17' |
| distribution: 'zulu' |
| |
| # Checkout |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| |
| # Build cache |
| - name: Cache Gradle Cache |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 |
| with: |
| path: ~/.gradle/caches |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }} |
| # An ordered list of keys to use for restoring the cache if no cache hit occurred for key |
| restore-keys: | |
| ${{ runner.os }}-gradle- |
| - name: Cache gradle wrapper |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 |
| with: |
| path: ~/.gradle/wrapper |
| key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| # Build KSP artifacts |
| - name: build |
| run: | |
| REF=${GITHUB_REF} # refs/tags/$KSP_VERSION |
| ./gradlew --info -PkspVersion=${REF:10} -PoutRepo=$(pwd)/build/repos/release publishAllPublicationsToMavenRepository |
| - name: pack |
| run: cd build/repos/release/ && zip -r ../../artifacts.zip . |
| |
| - name: Upload Release Asset |
| run: gh release upload $RELEASE_TAG ./build/artifacts.zip |
| env: |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| RELEASE_TAG: ${{ github.event.release.tag_name }} |