[actions] that awkward proverb on sed... #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build dist | |
on: | |
push: | |
pull_request: | |
jobs: | |
linux-build: | |
name: build on macos-14 | |
runs-on: macos-14 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
# Only for release tags | |
- name: setup gpg necessities | |
if: startsWith(github.ref, 'refs/tags/') | |
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > $WORKSPACE/'$SIGNING_SECRET_KEY_RING_FILE'" | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
- name: rewrite build.gradle.kts to require signing | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
sed -i "" "s/signing {}/signing { sign(publishing.publications) }/" compose-audio-controls/build.gradle.kts | |
sed -i "" "s/signing {}/signing { sign(publishing.publications) }/" compose-audio-controls-midi/build.gradle.kts | |
# build or publish, depending on whether it is for release tags or not | |
- name: build (ONLY FOR NON-RELEASES) | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
run: ./gradlew --warning-mode all build | |
- name: publish (ONLY FOR NEW RELEASE TAGS) | |
if: startsWith(github.ref, 'refs/tags/') | |
run: ./gradlew --warning-mode all publish dokkaHtml | |
env: | |
GITHUB_TOKEN: ${{ secrets.MAVEN_PAT }} | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ format('{0}/{1}', github.workspace, secrets.SIGNING_SECRET_KEY_RING_FILE) }} | |
- name: upload build failure logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-failure-logs | |
path: | | |
compose-audio-controls/build/reports/ | |
compose-audio-controls/*.log | |
compose-audio-controls-midi/build/reports/ | |
compose-audio-controls-midi/*.log | |
- name: upload artifact | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: library-artifacts | |
path: | | |
compose-audio-controls/build/libs/*.jar | |
compose-audio-controls/build/outputs/aar/*.aar | |
compose-audio-controls-midi/build/libs/*.jar | |
compose-audio-controls-midi/build/outputs/aar/*.aar | |
app/build/outputs/apk/debug/*.apk | |
# Update API reference | |
# FIXME: we should probably publish compose-audio-controls-midi API too | |
- name: deploy to GitHub Pages | |
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }} | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: compose-audio-controls/build/dokka/html |