mirror of
https://github.com/keyboardio/Chrysalis.git
synced 2026-03-05 18:23:22 +01:00
119 lines
3.6 KiB
YAML
119 lines
3.6 KiB
YAML
name: Publish production release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Node.js, NPM and Yarn
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 16
|
|
|
|
- name: Install udev-dev
|
|
run: sudo apt update && sudo apt install libudev-dev
|
|
if: runner.os == 'Linux'
|
|
|
|
- name: Set up yarn network timeout
|
|
run: yarn config set network-timeout 1000000 -g
|
|
|
|
- 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
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install Yarn dependencies
|
|
env:
|
|
YARN_GPG: no
|
|
GITHUB_RUN_NUMBER: ${{ github.run_number }}
|
|
run: yarn
|
|
- name: Prepare for app notarization
|
|
if: startsWith(matrix.os, 'macos')
|
|
# Import Apple API key for app notarization on macOS
|
|
run: |
|
|
mkdir -p ~/private_keys/
|
|
echo '${{ secrets.api_key }}' > ~/private_keys/AuthKey_${{ secrets.api_key_id }}.p8
|
|
- name: Build Chrysalis
|
|
uses: samuelmeuli/action-electron-builder@v1
|
|
env:
|
|
YARN_GPG: no
|
|
API_KEY_ID: ${{ secrets.api_key_id }}
|
|
API_KEY_ISSUER_ID: ${{ secrets.api_key_issuer_id }}
|
|
with:
|
|
# GitHub token, automatically provided to the action
|
|
# (No need to define this secret in the repo settings)
|
|
github_token: ${{ secrets.github_token }}
|
|
mac_certs: ${{ secrets.mac_certs }}
|
|
mac_certs_password: ${{ secrets.mac_certs_password }}
|
|
|
|
# We supply a build script name, so that we compile the source before
|
|
# trying to package them up. Without compiling them, we won't have the
|
|
# files to pack up.
|
|
build_script_name: build:${{ runner.os }}
|
|
|
|
# In this step, we only want to build Chrysalis, and never release. If
|
|
# we need to release, we do that in a separate step.
|
|
args: -p=never
|
|
release: false
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ runner.os }}-artifact
|
|
path: |
|
|
dist/Chrysalis-*
|
|
dist/latest*.yml
|
|
!dist/*.blockmap
|
|
|
|
publish:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Discover the current release version
|
|
id: version
|
|
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/v}
|
|
|
|
- name: Create the release news file
|
|
run: tools/release/news.sh >.news
|
|
|
|
- name: Create the new release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
|
VERSION: ${{ steps.version.outputs.tag }}
|
|
run: gh release create -t "Chrysalis ${VERSION}" -F .news v${VERSION}
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Publish a release
|
|
shell: bash
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
|
VERSION: ${{ steps.version.outputs.tag }}
|
|
run: gh release upload v${VERSION} artifacts/*/Chrysalis-* artifacts/*/latest*.yml
|