Skip to content

Use identity login to Azure #66

Use identity login to Azure

Use identity login to Azure #66

Workflow file for this run

name: Build Electron App
on:
workflow_dispatch:
workflow_call:
push:
branches:
- electron-app
permissions:
id-token: write
contents: read
jobs:
build_and_deploy_electron_app_job:
strategy:
matrix:
os: [{ name: 'windows', image: 'windows-latest' }, { name: 'macos', image: 'macos-latest' }]
runs-on: ${{ matrix.os.image }}
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build for production
run: npm run build:electron
- name: Login to Azure
if: ${{ matrix.os.name == 'windows' }}
uses: azure/login@v2
with:
auth-type: IDENTITY
client-id: ${{ secrets.BCCM_WINDOWS_CLIENT_ID }}
tenant-id: ${{ secrets.BCCM_WINDOWS_DIRECTORY_ID }}
subscription-id: ${{ secrets.BCCM_WINDOWS_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- name: Download certificate file from Key Vault
id: download-cert
if: ${{ matrix.os.name == 'windows' }}
uses: azure/get-keyvault-secrets@v1
with:
keyvault: 'bccm-code-sign2'
secrets: ${{ secrets.BCCM_WINDOWS_CLIENT_SECRET }}
continue-on-error: false
- name: Sign & build the Electron app for Windows
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "${{ steps.download-cert.outputs.HSM-CS }}" | base64 --decode >> developer-id.pfx
npm run publish
fi
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: developer-id.pfx
CSC_KEY_PASSWORD: ${{ secrets.BCCM_WINDOWS_CLIENT_PASSWORD }}
- name: Download certificate file & build the Electron app for Mac
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
echo $APPLE_DEVELOPER_ID_FILE | base64 --decode >> developer-id.p12
npm run publish
fi
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_DEVELOPER_ID_FILE: ${{secrets.BCCM_APPLE_DEVELOPER_ID_FILE}}
CSC_LINK: developer-id.p12
CSC_KEY_PASSWORD: ${{secrets.BCCM_APPLE_DEVELOPER_ID_PASSWORD}}
APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.BCCM_APPLE_APP_SPECIFIC_PASSWORD}}
APPLE_ID: ${{secrets.BCCM_APPLE_ID_USERNAME}}
APPLE_ID_PASSWORD: ${{secrets.BCCM_APPLE_APP_SPECIFIC_PASSWORD}}
APPLE_TEAM_ID: KJ6LCYQ3A8
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: app
path: |
dist-app/Bible-Explorers*