Skip to content

📤publish-dogu-agent-cloud-development-2.1.0-rc.14 #75

📤publish-dogu-agent-cloud-development-2.1.0-rc.14

📤publish-dogu-agent-cloud-development-2.1.0-rc.14 #75

# DO NOT CHANGE NAME because it is used in the workflow_dispatch event.
# Path: .github/workflows/publish-dogu-agent-cloud-development.yml
# If you change the name, you must also change the name of the workflow_dispatch event.
name: 📤publish-dogu-agent-cloud-development
run-name: 📤publish-dogu-agent-cloud-development-${{ github.event.inputs.version }}
on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Dogu Agent app version'
default: '0.0.1'
env:
YARN_CHECKSUM_BEHAVIOR: update yarn
CSC_FOR_PULL_REQUEST: true
jobs:
build:
strategy:
fail-fast: false
max-parallel: 99
matrix:
runner: [windows-2019, macos-latest]
include:
- runner: windows-2019
extension: exe
- runner: macos-latest
extension: dmg
runs-on: ['${{ matrix.runner }}']
env:
RUNNER_TOOL_CACHE: ${{ github.workspace }}/runner-tool-cache
GO_VERSION: '1.18.4'
steps:
- name: Version ${{ github.event.inputs.version }}
run: echo "${{ toJSON(github.event.inputs) }}"
- name: Checkout
uses: actions/checkout@v3
with:
clean: true
fetch-depth: 0
- name: Cache Yarn Unplugged
uses: actions/cache@v3
id: cache_yarn_unplugged
env:
cache-name: cache-yarn-unplugged
with:
path: ${{ github.workspace }}/.yarn/unplugged
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Cache Android buildfiles
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/projects/android-device-agent/android/app/build
${{ github.workspace }}/projects/android-device-agent/android/.gradle
key: ${{ runner.os }}-cache_android_files-${{ hashFiles('projects/android-device-agent/android/app/src/**') }} # It doesn't have to match exactly.
restore-keys: |
${{ runner.os }}-cache_android_files-
- name: Cache Go buildfiles
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/projects/go-device-controller/build
key: ${{ runner.os }}-cache_go_files-${{ hashFiles('projects/go-device-controller/internal/**') }} # It doesn't have to match exactly.
restore-keys: |
${{ runner.os }}-cache_go_files-
- name: Cache Electron
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.electron-cache
key: ${{ runner.os }}-cache_elctrons
- name: Cache Third-Party
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/third-party
key: ${{ runner.os }}-cache-thirdparty-${{ hashFiles('scripts/third-parties/download.ts') }}
- name: Cache NM Space node_modules
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/nm-space/node_modules
key: ${{ runner.os }}-cache_nm_space_node_modules-${{ hashFiles('yarn.lock') }}
- name: Windows - Msys2 - MIGW64 - Setup for cgo
uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
with:
msystem: MINGW64
location: ${{ github.workspace }}
install: >-
git
base-devel
mingw-w64-x86_64-gcc
- name: Windows - Setup Cmake
if: runner.os == 'Windows'
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.25.1
ninjaVersion: 1.11.1
- name: Macos - Setup Cmake
if: runner.os == 'macOS'
run: brew install cmake
env:
HOMEBREW_NO_AUTO_UPDATE: 1
continue-on-error: true
- name: Install the Apple certificate and provisioning profile
if: runner.os == 'macOS'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.DOGU_MACOS_CERTIFICATE_BASE64 }}
BUILD_APPLE_DOGU_DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DOGU_MACOS_APPLE_DOGU_DEVELOPMENT_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.DOGU_MACOS_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.DOGU_MACOS_WILDCARD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.DOGU_MACOS_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
DEVELOPMENT_CERTIFICATE_PATH=$RUNNER_TEMP/build_development_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_APPLE_DOGU_DEVELOPMENT_CERTIFICATE_BASE64" | base64 --decode -o $DEVELOPMENT_CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $DEVELOPMENT_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Common - Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/*/go.sum'
- name: Common - Set up JDK 11 for android build
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Common - Setup Android SDK
uses: android-actions/[email protected]
- if: steps.cache_yarn_unplugged.outputs.cache-hit != 'true'
name: Newbie
run: |
yarn run newbie:cicd
- name: Build Packages
run: |
yarn workspace dogu run rebuild:packages
- name: Download, Build third-party
run: |
yarn third-party:download:build
- name: Dogu Agent - Newbie nm-space
run: |
yarn workspace dogu run newbie:nm-space
- name: Dogu Agent - Install nm-space
run: |
yarn install
working-directory: ./nm-space
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: create dotEnv deploy
run: |
echo "DOGU_GITHUB_TOKEN=${{ secrets.DOGU_GITHUB_TOKEN }}" > .env.deploy-secret
echo "DOGU_APPLE_API_KEY_ID=${{ secrets.DOGU_APPLE_API_KEY_ID }}" >> .env.deploy-secret
echo "DOGU_APPLE_API_ISSUER_ID=${{ secrets.DOGU_APPLE_API_ISSUER_ID }}" >> .env.deploy-secret
echo "DOGU_APPLE_API_PRIVATEKEY=${{ secrets.DOGU_APPLE_API_PRIVATEKEY }}" >> .env.deploy-secret
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_DEV_ACCESS_KEY_ID }}" >> .env.deploy-secret
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}" >> .env.deploy-secret
working-directory: ./nm-space/projects/dost
- name: create dotEnv development
run: |
echo "DOGU_DEVICE_SERVER_PORT=5001" > .env.device-server
echo "DOGU_RUN_TYPE=development" >> .env.device-server
echo "NODE_ENV=development" >> .env.device-server
echo "DOGU_DEVICE_PLATFORM_ENABLED=windows,macos,android,ios" >> .env.device-server
echo "DOGU_API_BASE_URL=https://api.dev.dogutech.io" > .env.host-agent
echo "DOGU_DEVICE_SERVER_HOST_PORT=localhost:5001" >> .env.host-agent
echo "DOGU_HOST_TOKEN=" >> .env.host-agent
echo "DOGU_RUN_TYPE=development" >> .env.host-agent
echo "NODE_ENV=development" >> .env.host-agent
echo "DOGU_HOST_AGENT_PORT=5100" >> .env.host-agent
echo "DOGU_APPUPDATE_PROVIDER=s3" > .env.dost
echo "DOGU_APPUPDATE_URL=public.dev.dogutech.io" >> .env.dost
echo "DOGU_APPUPDATE_SUBPATH=dost" >> .env.dost
echo "DOGU_APPUPDATE_REGION=ap-northeast-2" >> .env.dost
working-directory: ./nm-space/projects/dost
- name: Dogu Agent - Set productName
run: |
yarn util:set-productname "Dogu-Agent-cloud-development" && yarn
working-directory: ./nm-space/projects/dost
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Dogu Agent - Set version ${{ github.event.inputs.version }}
run: |
yarn util:set-version ${{ github.event.inputs.version }}
working-directory: ./nm-space/projects/dost
- name: Dogu Agent - Build
run: |
yarn run build && yarn run deploy:publish
working-directory: ./nm-space/projects/dost
env:
ELECTRON_CACHE: ${{ github.workspace }}/.electron-cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.electron-cache/electron-builder
send-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ always() }}
steps:
- name: Send Slack
uses: dogu-team/[email protected]
with:
template: 'CD'
slack-channel-id: 'C03PL9TC44Q'
result-status: ${{ needs.build.result }}
ignore-notify: false
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}