Skip to content

Merge pull request #170 from orangebikelabs/dependabot/gradle/alpha/c… #337

Merge pull request #170 from orangebikelabs/dependabot/gradle/alpha/c…

Merge pull request #170 from orangebikelabs/dependabot/gradle/alpha/c… #337

Workflow file for this run

name: Release
concurrency: ci-release
# only completes full build & test cycle if release will be issued
on:
push:
branches:
- main
- beta
- alpha
env:
# this is the command needed to bootstrap the tooling for semantic-release based on our release configuration
semrel_package_bootstrap: "npm i semantic-release @semantic-release/changelog @semantic-release/git semantic-release-export-data conventional-changelog-conventionalcommits -D"
jobs:
get-next-version:
name: Detect next semantic version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare Node environment
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Bootstrap Semantic Release packages
run: ${{ env.semrel_package_bootstrap }}
- name: Semantic Release Dry Run
run: npx semantic-release --dry-run
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use limited token for readonly version probing
- run: "echo Detected next version: ${{ steps.semantic.outputs.new-release-version }}"
- run: "echo Release will be published: ${{ steps.semantic.outputs.new-release-published }}"
outputs:
new-release-published: ${{ steps.semantic.outputs.new-release-published }}
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
build:
env:
next_version_name: ${{ needs.get-next-version.outputs.new-release-version }}
next_build_number: ${{ github.run_number }}
name: Build & Test
needs: get-next-version
if: needs.get-next-version.outputs.new-release-published == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Prepare gradle environment
run: |
mkdir -p ~/.gradle
rm -f ~/.gradle/gradle.properties
touch ~/.gradle/gradle.properties
echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- name: Setting up keystores
run: |
echo ${{ secrets.RELEASE_KEYSTORE_BASE64 }} | base64 --decode > app/keystores/opensqueeze_release.jks
echo ${{ secrets.DEBUG_KEYSTORE_BASE64 }} | base64 --decode > app/keystores/opensqueeze_debug.jks
- run: echo Building with version ${{ env.next_version_name }}, build number ${{ env.next_build_number }}
- name: Build with Gradle
run: >
./gradlew
-PversionName=${{ env.next_version_name }}
-PbuildNumber=${{ env.next_build_number }}
-PreleaseKeystorePassword=${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
-PdebugKeystorePassword=${{ secrets.DEBUG_KEYSTORE_PASSWORD }}
build
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Java Tests # Name of the check run which will be created
path: "**/test-results/**/*.xml" # Path to test results
reporter: java-junit # Format of test results
- uses: actions/upload-artifact@v4
with:
retention-days: 1
name: builds
path: |
app/build/outputs/**/*.apk
app/build/outputs/mapping/**/mapping.txt
release:
name: Release to Github
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: builds
path: app/build/outputs
- name: Prepare Node environment
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Bootstrap Semantic Release packages
run: ${{ env.semrel_package_bootstrap }}
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # use supplied semantic release gh-token with extra permissions
cleanup:
name: Cleanup old builds
needs: release
runs-on: ubuntu-latest
steps:
- name: Cleanup beta builds
uses: dev-drprasad/delete-older-releases@v0.3.2
with:
keep_latest: 3
delete_tag_pattern: beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup alpha builds
uses: dev-drprasad/delete-older-releases@v0.3.2
with:
keep_latest: 3
delete_tag_pattern: alpha
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}