v2.2.10 #70
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
# .github/workflows/release.yml | |
name: Create release and publish | |
run-name: v${{inputs.version}} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to release" | |
required: true | |
prerelease: | |
description: "Is this a prerelease?" | |
default: true | |
required: false | |
type: boolean | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: self-hosted-macos-arm | |
arch: arm64 | |
name: darwin | |
- os: macos-latest | |
arch: x64 | |
name: darwin | |
- os: ubuntu-latest | |
arch: x64 | |
name: linux | |
- os: windows-2019 | |
arch: x64 | |
name: win32 | |
- os: ubuntu-latest | |
arch: x64 | |
name: linux | |
steps: | |
- uses: actions/checkout@v3 | |
- if: matrix.os == 'windows-2019' | |
name: Setup MSBuild | |
uses: seanmiddleditch/gha-setup-vsdevenv@master | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install NPM build dependencies | |
run: npm install node-gyp prebuild | |
- name: Update package version | |
uses: jaywcjlove/github-action-package@main | |
with: | |
version: ${{inputs.version}} | |
- name: Setup x64 python | |
if: matrix.arch != 'arm64' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Setup arm64 python | |
if: matrix.arch == 'arm64' | |
run: | | |
brew install [email protected] cmake | |
echo "NODE_GYP_FORCE_PYTHON=/opt/homebrew/bin/python3.10" >> $GITHUB_ENV | |
- name: Setup system dependencies | |
run: bash ./setup.sh ${{ matrix.arch }} | |
- name: Build | |
run: bash ./build.sh ${{ matrix.arch }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-${{matrix.name}}-${{matrix.arch}} | |
path: build/Release | |
retention-days: 1 | |
package: | |
runs-on: self-hosted-macos-arm | |
needs: build | |
steps: | |
- name: Download win build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-win32-x64 | |
path: build/Release | |
- name: Compress win artifacts | |
uses: a7ul/[email protected] | |
with: | |
command: c | |
files: ./build/Release | |
outPath: speech-recorder-v${{inputs.version}}-napi-v6-win32-x64.tar.gz | |
- name: Cleanup win build | |
run: rm -rf build/Release | |
- name: Download x64 macOS build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-darwin-x64 | |
path: build/Release-x64 | |
- name: Download arm64 macOS build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-darwin-arm64 | |
path: build/Release-arm64 | |
- name: Create universal macOS build | |
run: | | |
mkdir -p build/Release | |
lipo -create -output build/Release/libonnxruntime.1.10.0.dylib build/Release-x64/libonnxruntime.1.10.0.dylib build/Release-arm64/libonnxruntime.1.10.0.dylib | |
lipo -create -output build/Release/libportaudio.dylib build/Release-x64/libportaudio.dylib build/Release-arm64/libportaudio.dylib | |
lipo -create -output build/Release/libspeechrecorder.dylib build/Release-x64/libspeechrecorder.dylib build/Release-arm64/libspeechrecorder.dylib | |
lipo -create -output build/Release/speechrecorder.node build/Release-x64/speechrecorder.node build/Release-arm64/speechrecorder.node | |
- name: Compress macOS arm artifacts | |
uses: a7ul/[email protected] | |
with: | |
command: c | |
files: ./build/Release | |
outPath: speech-recorder-v${{inputs.version}}-napi-v6-darwin-arm64.tar.gz | |
- name: Compress macOS x64 artifacts | |
uses: a7ul/[email protected] | |
with: | |
command: c | |
files: ./build/Release | |
outPath: speech-recorder-v${{inputs.version}}-napi-v6-darwin-x64.tar.gz | |
- name: Cleanup macos build | |
run: rm -rf build/Release | |
- name: Download linux build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-linux-x64 | |
path: build/Release | |
- name: Compress linux artifacts | |
uses: a7ul/[email protected] | |
with: | |
command: c | |
files: ./build/Release | |
outPath: speech-recorder-v${{inputs.version}}-napi-v6-linux-x64.tar.gz | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: speech-recorder-dist | |
path: speech-recorder-*.tar.gz | |
retention-days: 1 | |
- name: Cleanup linux build | |
run: rm -rf build/Release | |
release-and-publish: | |
name: Create release and publish | |
runs-on: ubuntu-latest | |
needs: package | |
steps: | |
- name: Checkout to base branch | |
uses: actions/checkout@v3 | |
- name: Get base version number from input | |
id: get-base-version | |
uses: frabert/replace-string-action@v2 | |
with: | |
pattern: '-rc\d*' | |
string: "v${{inputs.version}}" | |
replace-with: "" | |
- name: Check if release tag exists | |
uses: mukunku/[email protected] | |
id: check-release | |
with: | |
tag: ${{steps.get-base-version.outputs.replaced}} | |
- name: Create release branch | |
if: steps.check-release.outputs.exists == 'false' | |
run: git checkout -b release/${{steps.get-base-version.outputs.replaced}} && git push -u origin release/${{steps.get-base-version.outputs.replaced}} | |
- name: Merge base into release | |
if: steps.check-release.outputs.exists == 'true' | |
uses: everlytic/[email protected] | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
source_ref: ${{ github.ref }} | |
target_branch: release/${{steps.get-base-version.outputs.replaced}} | |
commit_message_template: "[Automated] Merged {source_ref} into target {target_branch}" | |
- name: Checkout to release branch | |
uses: actions/checkout@v3 | |
with: | |
ref: release/${{steps.get-base-version.outputs.replaced}} | |
- name: Update package version | |
uses: jaywcjlove/github-action-package@main | |
with: | |
version: ${{inputs.version}} | |
- run: npm install --ignore-scripts | |
- name: Commit changes to release branch | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Bump package version to v${{inputs.version}}" | |
file_pattern: package*.json | |
tagging_message: v${{inputs.version}} | |
- name: Update the release tag | |
uses: richardsimko/update-tag@v1 | |
with: | |
tag_name: ${{steps.get-base-version.outputs.replaced}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download speech-recorder artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: speech-recorder-dist | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: speech-recorder-* | |
allowUpdates: true | |
generateReleaseNotes: true | |
name: ${{steps.get-base-version.outputs.replaced}} | |
prerelease: ${{inputs.prerelease}} | |
tag: ${{steps.get-base-version.outputs.replaced}} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |