From e7f27b8f3bb76c392f2cce254adb7682d9cd7ee1 Mon Sep 17 00:00:00 2001 From: Tomasz Ancukiewicz Date: Mon, 5 Feb 2024 13:58:30 +0100 Subject: [PATCH] [PCE-2803] add simple release workflow --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 2 +- artifactory/release.gradle | 4 ---- build.gradle | 4 ++++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e3a20d8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build and release +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + if: "startsWith(github.event.head_commit.message, 'Release: ')" + steps: + - uses: actions/checkout@v3 + - name: Setup Java JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 11 + - name: Get app version + id: app_version + run: echo "APP_VERSION=$(./gradlew version --no-daemon --console=plain -q)" >> $GITHUB_OUTPUT + - name: Check release with local version + if: ${{ github.event.head_commit.message != format('Release: {0}', steps.app_version.outputs.APP_VERSION) }} + run: | + echo "Local version doesn't match commit version" + exit 1 + - name: Run test + run: ./gradlew test + - name: Create release in artifactory + env: + REPOSITORY_USERNAME: ${{ secrets.REPOSITORY_USERNAME }} + REPOSITORY_PASSWORD: ${{ secrets.REPOSITORY_PASSWORD }} + run: | + ./gradlew assembleRelease assembleReleaseUnitTest \ + -PrepositoryUserName=${{ env.REPOSITORY_USERNAME }} \ + -PrepositoryPassword=${{ env.REPOSITORY_PASSWORD }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d16905d..d36cd5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Run tests on: [push, pull_request] jobs: - macos: + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/artifactory/release.gradle b/artifactory/release.gradle index 1cd97e7..1fcfbbc 100644 --- a/artifactory/release.gradle +++ b/artifactory/release.gradle @@ -65,10 +65,6 @@ publishing { } } - - - - artifactory { contextUrl = repositoryPath diff --git a/build.gradle b/build.gradle index 7c753a5..470b352 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,10 @@ tasks.register('clean', Delete) { delete rootProject.buildDir } +tasks.register("version") { + println(versionName) +} + project.ext { //libraries multidexVersion = "2.0.1"