Skip to content

Update build process to include generating dev certificate, installin… #175

Update build process to include generating dev certificate, installin…

Update build process to include generating dev certificate, installin… #175

Workflow file for this run

name: Release
on:
push:
branches:
- release
jobs:
build-mac-linux:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
arch: [x64, arm64]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Build Electron app
run: |
npm run make -- --arch=${{ matrix.arch }}
env:
ELECTRON_CACHE: ${{ runner.temp }}/electron
npm_config_arch: ${{ matrix.arch }}
npm_config_platform: ${{ matrix.os == 'macos-latest' && 'darwin' || 'linux' }}
- name: Extract version from package.json
run: |
VERSION=$(node -e "console.log(require('./package.json').version);")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts-${{ matrix.os }}-${{ matrix.arch }}
path: out/make/
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install Microsoft Build Tools
run: |
choco install microsoft-build-tools -y
shell: pwsh
- name: Verify makeappx.exe and build & sign the appx
run: |
# Verify makeappx.exe
$makeappxPath = 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe'
if (Test-Path $makeappxPath) {
echo "makeappx.exe found at $makeappxPath"
$env:WINDOWS_KIT_PATH="C:\Program Files (x86)\Windows Kits\10\App Certification Kit"
} else {
Write-Error "makeappx.exe not found."
exit 1
}
# Install dependencies
npm install
# Provide environment variables for signing during the build
$env:CERT_PATH=$certPath
$env:CERT_PASSWORD=$certPassword
# Build and sign the appx using Electron Forge
npm run make
env:
WINDOWS_KIT_PATH: ${{ env.WINDOWS_KIT_PATH }}
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
shell: pwsh
- name: Extract version from package.json
run: |
$version = (node -e "console.log(require('./package.json').version);")
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts-windows
path: out/make/
upload-artifacts:
needs: [build-mac-linux, build-windows]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts (macos-latest x64)
uses: actions/download-artifact@v3
with:
name: build-artifacts-macos-latest-x64
- name: Download build artifacts (macos-latest arm64)
uses: actions/download-artifact@v3
with:
name: build-artifacts-macos-latest-arm64
- name: Download build artifacts (ubuntu-latest x64)
uses: actions/download-artifact@v3
with:
name: build-artifacts-ubuntu-latest-x64
- name: Download build artifacts (ubuntu-latest arm64)
uses: actions/download-artifact@v3
with:
name: build-artifacts-ubuntu-latest-arm64
- name: Download build artifacts (windows)
uses: actions/download-artifact@v3
with:
name: build-artifacts-windows
- name: Upload files to Cloudflare R2
run: |
for file in $(find out/make/ -type f); do
echo "Uploading $(basename "$file")"
aws s3 cp "$file" "s3://${{ secrets.R2_BUCKET }}/releases/v${{ env.VERSION }}/$(basename "$file")" \
--endpoint-url="${{ secrets.R2_ENDPOINT }}" --debug
done
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.R2_REGION }}
shell: bash
create-release:
needs: [build-mac-linux, build-windows]
runs-on: ubuntu-latest
steps:
- name: Extract version from package.json
run: |
VERSION=$(node -e "console.log(require('./package.json').version);")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
body: |
Changes in this Release
draft: true
prerelease: false