Skip to content

Commit

Permalink
adding separate deploy stage
Browse files Browse the repository at this point in the history
  • Loading branch information
arnk-basyskom committed Jan 25, 2024
1 parent aa62e5d commit 627c6b2
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 18 deletions.
49 changes: 32 additions & 17 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
name: Android
name: Android Build

on:
workflow_call:
workflow_dispatch:
push:
branches:
- '*'
- '!main'
pull_request:
branches:
- main

env:
QTOPCUA_BUILD_ARGS: "-DFEATURE_open62541_security:BOOL=ON -DFEATURE_gds:BOOL=ON -DCMAKE_BUILD_TYPE=Release"
QT_PATH: "/opt/Qt/6.6.1"
SSL_PATH: "dependencies/android_openssl/ssl_3"
ANDROID_VERSION_CODE: ${{github.run_number}}
ANDROID_VERSION_NAME: "0.0.0"

jobs:
build:
runs-on: ubuntu-latest
android-build:
runs-on: thuban
container:
image: stateoftheartio/qt6:6.6-android-aqt
options: --user root
timeout-minutes: 60
env:
QTOPCUA_BUILD_ARGS: "-DFEATURE_open62541_security:BOOL=ON -DFEATURE_gds:BOOL=ON -DCMAKE_BUILD_TYPE=Release"
QT_PATH: "/opt/Qt/6.6.1"
SSL_PATH: "dependencies/android_openssl/ssl_3"
ANDROID_VERSION_CODE: "3"
ANDROID_VERSION_NAME: "1.0.0"

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -73,6 +83,14 @@ jobs:
cmake --build ./build/qtopcua
/opt/Qt/Tools/CMake/bin/cmake --install ./build/qtopcua
rm -rf ./build/qtopcua
- name: Check if we build a tag
id: checkref
run: echo ::set-output name=is_tag::$(echo "${{ github.ref }}" | grep -q '^refs/tags/' && echo true || echo false)
- name: Set Version
if: steps.checkref.outputs.is_tag == 'true'
run: |
TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///')
echo "ANDROID_VERSION_NAME=$TAG" >> $GITHUB_ENV
- name: Build App
run: |
mkdir -p ./build/opc_ua_browser && \
Expand Down Expand Up @@ -103,14 +121,11 @@ jobs:
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "33.0.0"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Signed app bundle
name: android-apk
path: ${{steps.sign_apk.outputs.signedReleaseFile}}
- uses: r0adkll/upload-google-play@v1
- uses: actions/upload-artifact@v3
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
releaseFiles: ${{steps.sign_aab.outputs.signedReleaseFile}}
packageName: com.basyskom.opcua.app
track: internal
status: draft
name: android-abb
path: ${{steps.sign_aab.outputs.signedReleaseFile}}
57 changes: 57 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
uses: ./.github/workflows/android.yml
if: github.ref == 'refs/heads/main'


deploy:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: thuban
steps:
- uses: actions/download-artifact@v3
- name: Get Version Tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Rename APK
run: mv ./android-apk/android-build-release-unsigned-signed.apk ./android-apk/opc-ua-browser_${{ github.run_number }}_${{ env.RELEASE_VERSION }}.apk
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
body: |
New Release ${{ env.RELEASE_VERSION }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./android-apk/opc-ua-browser_${{ github.run_number }}_${{ env.RELEASE_VERSION }}.apk
asset_name: opc-ua-browser_${{ github.run_number }}_${{ env.RELEASE_VERSION }}.apk
asset_content_type: application/zip
#${GITHUB_REF#refs/*/}
#- uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
# releaseFiles: ./android-abb/android-build-release.aab
# packageName: com.basyskom.opcua.app
# track: internal
# status: draft


# ./android-abb/android-build-release.aab
# ./android-apk/android-build-release-unsigned-signed.apk
4 changes: 3 additions & 1 deletion .github/workflows/qmllint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ jobs:
with:
fetch-depth: 1
- name: Validate QML
uses: liri-infra/qmllint-action@master
uses: liri-infra/qmllint-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 627c6b2

Please sign in to comment.