ci: refactor manual deployment CI config into 1 workflow #554
Workflow file for this run
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: Publish Snapshot builds | |
on: [pull_request] | |
permissions: | |
pull-requests: write # Write access needed to create a comment. | |
jobs: | |
publish: | |
name: Snapshot build and publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-android | |
# Using branch name for name of snapshot. Makes it easy to remember and can easily trigger new builds of Remote Habits. | |
- name: Set snapshot version | |
id: set-snapshot-version | |
# Get the current branch name and replace all / characters with - as / is invalid in gradle names. | |
run: echo "::set-output name=VERSION::$(echo '${{ github.event.pull_request.head.ref }}' | sed -r 's/\//-/g')-SNAPSHOT" | |
- name: Publish to MavenCentral | |
run: ./gradlew publishReleasePublicationToSonatypeRepository | |
env: | |
OSSRH_USERNAME: ${{ secrets.GRADLE_PUBLISH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.GRADLE_PUBLISH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.GRADLE_SIGNING_KEYID }} | |
SIGNING_PASSWORD: ${{ secrets.GRADLE_SIGNING_PASSPHRASE }} | |
SIGNING_KEY: ${{ secrets.GRADLE_SIGNING_PRIVATE_KEY }} | |
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
MODULE_VERSION: ${{ steps.set-snapshot-version.outputs.VERSION }} | |
SNAPSHOT: true | |
- name: Find old comment to update comment for | |
uses: peter-evans/find-comment@v2 | |
id: find-previous-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Build available to test | |
- name: Inform pull request on build of SDK available to test | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.find-previous-comment.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
Build available to test | |
Version: `${{ steps.set-snapshot-version.outputs.VERSION }}` | |
Repository: `https://s01.oss.sonatype.org/content/repositories/snapshots/` | |
edit-mode: replace | |
token: ${{ secrets.GITHUB_TOKEN }} |