Created
January 12, 2021 01:32
-
-
Save hibearpanda/d5b5b58bd319132ffd7af606ffa333fc to your computer and use it in GitHub Desktop.
Github Actions for building Electron Wix Installer
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: Build for Staging | |
on: | |
push: | |
branches: | |
- buildCi | |
jobs: | |
build-and-distribute: | |
runs-on: windows-latest | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@master | |
- name: Use Node.js 12.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- name: Add .npmrc | |
run: | | |
echo "@idisclosure-legalx:registry = https://npm.pkg.github.com" > ~/.npmrc | |
echo "_authToken = ${{ secrets.PRIVATE_PACKAGE_ACCESS_TOKEN }}" >> ~/.npmrc | |
echo "always-auth = true" >> ~/.npmrc | |
shell: bash | |
# https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Dependencies | |
run: yarn --frozen-lockfile | |
- name: Generate icons | |
run: yarn icons:generate | |
- name: Generate config.json | |
run: echo "{\"BUILD_ENVIRONMENT\":\"staging\"}" | Out-File -FilePath "$env:GITHUB_WORKSPACE\config.json" -Encoding utf8 | |
- name: Download Code Signing Certificate | |
env: | |
CODE_SIGNING_CERTIFICATE_URL: ${{ secrets.CODE_SIGNING_CERTIFICATE_URL }} | |
run: Invoke-WebRequest -Uri "$env:CODE_SIGNING_CERTIFICATE_URL" -OutFile "$env:GITHUB_WORKSPACE\code-sign\cert.pfx" | |
# https://github.com/felixrieseberg/electron-wix-msi/issues/1#issuecomment-674598795 | |
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path | |
# https://stackoverflow.com/a/64831469 | |
# https://github.community/t/set-path-for-wix-toolset-in-windows-runner/154708 | |
- name: Set path for candle and light | |
env: | |
WIX_PATH: ${{ env.wix }} | |
run: echo "$env:WIX_PATH\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Build Installer | |
run: WINDOWS_CERTIFICATE_PASSWORD=${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} yarn make:win32:staging | |
shell: bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment