diff --git a/.github/workflows/test-and-stage.yaml b/.github/workflows/test-and-stage.yaml index bf3834b..6fd1975 100644 --- a/.github/workflows/test-and-stage.yaml +++ b/.github/workflows/test-and-stage.yaml @@ -1,4 +1,4 @@ -name: test-and-stage +name: ci on: push: @@ -56,10 +56,6 @@ jobs: steps: - uses: actions/checkout@master - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@master - with: - python-version: ${{ matrix.python-version }} - name: Setup JDK uses: actions/setup-java@master with: @@ -89,3 +85,53 @@ jobs: target_branch: staging github_token: ${{ github.token }} + + release-flag: + if: contains(github.event.head_commit.message, '!!release') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + + + gh-release: + needs: [release-flag, to-staging] + timeout-minutes: 10 + + runs-on: ubuntu-latest + + strategy: + steps: + - uses: actions/checkout@master + - name: Setup JDK + uses: actions/setup-java@master + with: + java-version: 17 + distribution: 'temurin' + cache: gradle + - name: Get the project version + id: get_version + run: | + git fetch --all --tags + VERSION=$(./gradlew properties | grep version | awk '{print $2}') + echo "Version $VERSION" + + [[ ! $A =~ .*SNAPSHOT.* ]] # check it's not a snapshot version + [[ -z $(git tag -l $VERSION) ]] # check this version was not published + + echo "result=$VERSION" >>$GITHUB_OUTPUT + - name: Build + run: | + export GPG_TTY=$(tty) + ./gradlew uberJar + mv ./build/libs/mavence.uber.jar ./build/libs/mavence.jar + env: + MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }} + MAVEN_GPG_PASSWORD: ${{ secrets.MAVEN_GPG_PASSWORD }} + - name: Publish GitHub release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.get_version.outputs.result }} + files: ./build/libs/mavence.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle.kts b/build.gradle.kts index 5234a40..847b162 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "io.github.rtmigo" -version = "1.0-SNAPSHOT" +version = "0.1.0" // -SNAPSHOT repositories { mavenCentral()