⬆️ Update codecov/codecov-action action to v4 - autoclosed #213
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 | |
on: | |
pull_request: | |
branches: [ "main" ] | |
types: [ "closed" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Get release-label | |
id: release-label | |
uses: actions-ecosystem/action-release-label@v1 | |
with: | |
label_prefix: release/ | |
- name: Get latest tag | |
id: get-latest-tag | |
if: ${{ steps.release-label.outputs.level != null }} | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
with: | |
semver_only: true | |
- name: Bump semver | |
id: bump-semver | |
if: ${{ steps.release-label.outputs.level != null }} | |
uses: actions-ecosystem/action-bump-semver@v1 | |
with: | |
current_version: ${{ steps.get-latest-tag.outputs.tag }} | |
level: ${{ steps.release-label.outputs.level }} | |
- name: Setup JDK 17 | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
version: "latest" | |
java-version: "17" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
if: ${{ steps.bump-semver.outputs.new_version != null }} | |
id: publish | |
run: | | |
SEMANTIC_NEW_VERSION=$(echo ${{ steps.bump-semver.outputs.new_version }} | sed -e 's/^v//') | |
./gradlew -Pmcorouhlin.version=$SEMANTIC_NEW_VERSION publishToSonatype closeAndReleaseSonatypeStagingRepository | |
echo "::set-output name=new_semantic_version::${SEMANTIC_NEW_VERSION}" | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
- name: Push tag | |
if: ${{ steps.bump-semver.outputs.new_version != null }} | |
uses: actions-ecosystem/action-push-tag@v1 | |
with: | |
tag: ${{ steps.bump-semver.outputs.new_version }} | |
message: '${{ steps.bump-semver.outputs.new_version }}(PR #${{ github.event.pull_request.number }}): ${{ github.event.pull_request.title }}' | |
- name: Comment new version to PR | |
if: ${{ steps.bump-semver.outputs.new_version != null }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.html_url }} | |
VERSION: ${{ steps.publish.outputs.new_semantic_version }} | |
run: | | |
cat << EOS > comments | |
## v${VERSION} is now available! | |
To use this version, please write dependencies in \`build.gradle.kts\` as | |
\`\`\` | |
implementation("land.vani.mcorouhlin:mcorouhlin-api:${VERSION}") | |
implementation("land.vani.mcorouhlin:mcorouhlin-paper:${VERSION}") | |
\`\`\` | |
EOS | |
gh pr comment "${URL}" --body-file ./comments |