Skip to content

publish

publish #49

Workflow file for this run

name: publish
on:
workflow_run:
workflows:
- verify
types:
- completed
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'master'
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Extract version from build.gradle.kts
id: get_version
run: echo "VERSION=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT
- name: Create Git tag
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub 토큰 추가
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${VERSION}" -m "Release version ${VERSION}"
git push --force origin "v${VERSION}"
- name: Set up GPG
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
gpg-connect-agent reloadagent /bye
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Configure gradle.properties
run: |
echo "mavenCentralUsername=${{ secrets.OSSRH_USERNAME }}" >> gradle.properties
echo "mavenCentralPassword=${{ secrets.OSSRH_PASSWORD }}" >> gradle.properties
- name: Publish to Maven Central
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
./gradlew publishAllPublicationsToMavenCentralRepository