3.2.5 #47
Workflow file for this run
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: Deploy release | |
on: | |
release: | |
types: [prereleased, released] | |
jobs: | |
deploy-apk: | |
runs-on: ubuntu-22.04 | |
outputs: | |
VCODE: ${{ steps.get_vcode.outputs.VCODE }} | |
steps: | |
- uses: gitboard-io/gitboard-action@main | |
with: | |
username: frimtec | |
key: ${{ secrets.GITBOARD_IO_KEY }} | |
- uses: actions/checkout@v4 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | |
- name: Get release | |
id: get_release | |
uses: bruceadams/get-release@v1.3.2 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Set version | |
run: | | |
sed -i 's/$version/${{ steps.get_version.outputs.VERSION }}/g' app/version.properties | |
- name: Get VCODE | |
id: get_vcode | |
run: echo "VCODE=$(expr $(date +%s) / 60 - 26797800)" >> $GITHUB_OUTPUT | |
- name: Build APK | |
run: bash ./gradlew assembleRelease --stacktrace -Dversion.code=${{ steps.get_vcode.outputs.VCODE }} | |
- name: Setup build tool version variable | |
shell: bash | |
run: | | |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | |
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | |
echo Last build tool version is: $BUILD_TOOL_VERSION | |
- uses: r0adkll/sign-android-release@v1 | |
name: Sign app APK | |
id: sign_app_apk | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | |
- name: Upload APK Release Asset | |
id: upload-release-asset-apk | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ${{steps.sign_app_apk.outputs.signedReleaseFile}} | |
asset_name: app-release.apk | |
asset_content_type: application/zip | |
deploy-aar: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | |
- name: Get release | |
id: get_release | |
uses: bruceadams/get-release@v1.3.2 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Set version | |
run: | | |
sed -i 's/$version/${{ steps.get_version.outputs.VERSION }}/g' app/version.properties | |
- name: Build AAR | |
run: bash ./gradlew :securesmsproxyapi:assembleRelease --stacktrace | |
- name: Upload AAR Release Asset | |
id: upload-release-asset-aar | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: securesmsproxyapi/build/outputs/aar/securesmsproxyapi-release.aar | |
asset_name: securesmsproxyapi-release.aar | |
asset_content_type: application/zip | |
- name: Prepare Ringfile | |
if: steps.get_release.outputs.prerelease == 'false' | |
run: echo "${{ secrets.gpg_ringfile }}" | base64 --decode > ringfile | |
- name: Publish AAR | |
if: steps.get_release.outputs.prerelease == 'false' | |
run: bash ./gradlew :securesmsproxyapi:publish --stacktrace | |
env: | |
SIGNING_KEYID: ${{ secrets.gpg_key_id }} | |
SIGNING_PASSWORD: ${{ secrets.gpg_passphrase }} | |
SIGNING_RINGFILE: ../ringfile | |
OSS_USERNAME: ${{ secrets.nexus_username }} | |
OSS_PASSWORD: ${{ secrets.nexus_password }} | |
update-repo: | |
runs-on: ubuntu-22.04 | |
needs: deploy-apk | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | |
- name: Checkout master | |
run: | | |
git checkout master | |
- name: Update README.md | |
run: | | |
sed -i "s/'com.github.frimtec:secure-sms-proxy-api:.*'/'com.github.frimtec:secure-sms-proxy-api:${{ steps.get_version.outputs.VERSION }}@aar'/g" README.md | |
- name: Get release | |
id: get_release | |
uses: bruceadams/get-release@v1.3.2 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Create fastlane changelog | |
run: | | |
mkdir -p fastlane/metadata/android/en-US/changelogs | |
echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' | head -n 10 >> fastlane/metadata/android/en-US/changelogs/${{needs.deploy-apk.outputs.VCODE}}.txt | |
- name: Commit changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git add fastlane/metadata/android/en-US/changelogs/${{needs.deploy-apk.outputs.VCODE}}.txt | |
git commit -m "Update release version/changelog for ${{ steps.get_version.outputs.VERSION }}" | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: 'master' |