diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index 2f429d1..8958d27 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -27,6 +27,7 @@ jobs: env: VERSION: ${{ github.ref_name }} RELEASE_VERSION: ${{ github.ref_name }} + SNAPSHOT: ${{ endsWith(github.ref_name, '-snapshot') || contains(github.event.head_commit.message, '[snapshot]') }} steps: - name: Checkout mod repo uses: actions/checkout@v3 @@ -64,6 +65,10 @@ jobs: - name: Release under current tag run: | + PRERELEASE="" + if [[ "$SNAPSHOT" == "true" ]]; then + PRERELEASE="--prerelease" + fi export "CHANGELOG_FILE=$(mktemp --suffix=.md)" echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV gh api --method POST -H "Accept: application/vnd.github+json" \ @@ -71,12 +76,11 @@ jobs: -f tag_name="${RELEASE_VERSION}" \ --jq ".body" > "${CHANGELOG_FILE}" cat "${CHANGELOG_FILE}" - gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ./build/libs/*.jar + gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" $PRERELEASE ./build/libs/*.jar shell: bash continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: ${{ !contains(github.event.head_commit.message, '[snapshot]') }} - name: Publish to Maven run: ./gradlew --build-cache --info --stacktrace build publish @@ -92,4 +96,4 @@ jobs: env: MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} - if: ${{ !contains(github.event.head_commit.message, '[snapshot]') }} + if: env.snapshot == 'false'