Electron 25 #50
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 | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ "master" ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ "master" ] | |
env: | |
PACKAGE_DIRECTORY: color-picker | |
PACKAGE_NAME: color-picker | |
BUILD_CONFIGURATION: RelWithDebInfo | |
BUILD_DIRECTORY: "build" | |
DISTRIBUTE_DIRECTORY: "distribute" | |
RELEASE_BUCKET: "obs-studio-deployment" | |
ELECTRON_VERSION: "v25.9.3" | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: 'Build a package' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Show GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
shell: bash | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Install dependencies | |
run: yarn install --immutable --immutable-cache --check-cache | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v1 | |
- name: Configure | |
run: cmake -H"${{ github.workspace }}" -B"${{env.BUILD_DIRECTORY}}" -G"Visual Studio 17 2022" -A x64 -DNODEJS_VERSION="${{env.ELECTRON_VERSION}}" -DCMAKE_INSTALL_PREFIX="${{env.INSTALL_PACKAGE_PATH}}" | |
env: | |
INSTALL_PACKAGE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}/${{env.PACKAGE_DIRECTORY}}" | |
- name: Build | |
run: cmake --build "${{env.BUILD_DIRECTORY}}" --target install --config ${{env.BUILD_CONFIGURATION}} | |
- name: Put version into package.json | |
if: startsWith(github.ref, 'refs/tags/') | |
run: node ci/bump-version.js "${{ steps.get_version.outputs.VERSION }}" "${{env.PACKAGE_PATH}}" | |
env: | |
PACKAGE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}/${{env.PACKAGE_DIRECTORY}}" | |
- name: Cache build | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.BUILD_DIRECTORY}} | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
upload_debug_symbols: | |
needs: build | |
name: 'Upload debug symbols' | |
runs-on: windows-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Get build from cache | |
id: cache-check | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.BUILD_DIRECTORY}} | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Check cache | |
if: steps.cache-check.outputs.cache-hit != 'true' | |
run: exit 1 | |
- name: Fetch symsrv-scripts | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
repository: stream-labs/symsrv-scripts | |
path: symsrv-scripts | |
- name: Run symbol server scripts | |
run: ./symsrv-scripts/main.bat "${{ github.workspace }}/symsrv-scripts" ".\main.ps1 -localSourceDir '${{ github.workspace }}' -repo_userId 'stream-labs' -repo_name '${{env.PACKAGE_NAME}}' -repo_branch '${{ github.sha }}'" | |
env: | |
AWS_SYMB_ACCESS_KEY_ID: ${{secrets.AWS_SYMB_ACCESS_KEY_ID}} | |
AWS_SYMB_SECRET_ACCESS_KEY: ${{secrets.AWS_SYMB_SECRET_ACCESS_KEY}} | |
shell: powershell | |
upload_release_package: | |
needs: build | |
name: 'Upload release package' | |
runs-on: windows-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
shell: bash | |
- name: Get build from cache | |
id: cache-check | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.BUILD_DIRECTORY}} | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Check cache | |
if: steps.cache-check.outputs.cache-hit != 'true' | |
run: exit 1 | |
- name: Tar artifact for deployment | |
run: tar -cvzf ${{env.TARGET_ARTIFACT}}.tar.gz -C ${{env.INSTALL_DISTRIBUTE_PATH}} ${{env.PACKAGE_DIRECTORY}} | |
env: | |
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-win64 | |
INSTALL_DISTRIBUTE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}} | |
aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}} | |
aws-region: us-west-2 | |
- name: Deploy | |
run: aws s3 cp ${{env.TARGET_ARTIFACT}}.tar.gz s3://${{env.RELEASE_BUCKET}} --acl public-read | |
env: | |
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-win64 |