Publish SNAPSHOT versions #18
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 versions | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- release/** | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Extract branch name | |
run: | | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
VERSION=${BRANCH_NAME:8} # remove 'release/' prefix | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Delete previous SNAPSHOT packages | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build run | |
env: | |
PACKAGE_TYPE: maven | |
VERSION_TAG: ${{ env.VERSION }}-SNAPSHOT | |
IS_VERSION_TAG_STRICT: true | |
GITHUB_TOKEN: ${{ secrets.DELETE_PACKAGES_TOKEN }} | |
- name: Publish new SNAPSHOT package | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: publish -Pversion=${{ env.VERSION }}-SNAPSHOT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |