Update config.ts #434
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 | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.target.rid }} | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- goos: windows | |
rid: win-x64 | |
os: windows-2022 | |
- goos: linux | |
rid: linux-x64 | |
os: ubuntu-20.04 | |
- goos: darwin | |
rid: osx-x64 | |
os: macos-12 | |
runs-on: ${{ matrix.target.os }} | |
env: | |
GOOS: ${{ matrix.target.goos }} | |
GOARCH: amd64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Prepare Tag | |
id: tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
VERSION="${GITHUB_REF##refs/tags/}" | |
BUILD_VERSION="${VERSION:1}" | |
BUILD_NUMBER="$(git rev-list HEAD --count)" | |
echo "Found Tag: ${VERSION}" | |
echo "Build Version: ${BUILD_VERSION}" | |
echo "Build Number: ${BUILD_NUMBER}" | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
echo "build_version=${BUILD_VERSION}" >> $GITHUB_OUTPUT | |
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Draft Release | |
if: matrix.target.goos == 'linux' && startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }} | |
run: | | |
gh release create ${{ steps.tag.outputs.version }} -d | |
shell: bash | |
- name: Cache Build Caches | |
uses: actions/cache@v3 | |
with: | |
path: build/caches/ | |
key: koi-${{ runner.os }}-${{ hashFiles('config.ts') }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: yarn | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ~1.19.0 | |
cache: true | |
cache-dependency-path: config.ts | |
- name: Install Dependencies (macOS) | |
if: matrix.target.goos == 'darwin' | |
run: brew install graphicsmagick imagemagick | |
shell: bash | |
- name: Install Dependencies (Linux) | |
if: matrix.target.goos == 'linux' | |
run: | | |
sudo apt update | |
sudo apt install -y fuse libfuse2 | |
shell: bash | |
- name: Install Build Package | |
run: | | |
yarn install --frozen-lockfile | |
shell: bash | |
- name: Build Koi | |
run: | | |
yarn gulp ciBuild | |
shell: bash | |
- name: Upload zip for Windows to Build Artifact | |
if: matrix.target.goos == 'windows' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip | |
path: build/dist/koishi.zip | |
- name: Upload msi for Windows to Build Artifact | |
if: matrix.target.goos == 'windows' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.msi | |
path: build/dist/koishi.msi | |
- name: Upload zip for macOS to Build Artifact | |
if: matrix.target.goos == 'darwin' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip | |
path: build/dist/koishi.zip | |
- name: Upload dmg for macOS to Build Artifact | |
if: matrix.target.goos == 'darwin' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.dmg | |
path: build/dist/koishi.dmg | |
- name: Upload pkg for macOS to Build Artifact | |
if: matrix.target.goos == 'darwin' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.pkg | |
path: build/dist/koishi.pkg | |
- name: Upload zip for Linux to Build Artifact | |
if: matrix.target.goos == 'linux' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip | |
path: build/dist/koishi.zip | |
- name: Upload AppImage for Linux to Build Artifact | |
if: matrix.target.goos == 'linux' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.AppImage | |
path: build/dist/Koishi.AppImage | |
- name: Upload Release Files for Windows to GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'windows' | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }} | |
run: | | |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip | |
mv build/dist/koishi.msi build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi | |
gh release upload ${{ steps.tag.outputs.version }} \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi | |
shell: bash | |
- name: Upload Release Files for macOS to GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'darwin' | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }} | |
run: | | |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip | |
mv build/dist/koishi.dmg build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg | |
mv build/dist/koishi.pkg build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg | |
gh release upload ${{ steps.tag.outputs.version }} \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg | |
shell: bash | |
- name: Upload Release Files for Linux to GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'linux' | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }} | |
run: | | |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip | |
mv build/dist/Koishi.AppImage build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage | |
gh release upload ${{ steps.tag.outputs.version }} \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \ | |
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage | |
shell: bash | |
- name: Upload Release Files for Windows to App Center | |
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'windows' | |
run: | | |
yarn appcenter distribute release --disable-telemetry -t 1000000 \ | |
--token ${{ secrets.APPCENTER_DEPLOY_KEY }} \ | |
-a koishi/Koishi-Desktop-for-Windows \ | |
-g stable \ | |
-b ${{ steps.tag.outputs.build_version }} \ | |
-f build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi | |
shell: bash | |
- name: Upload Release Files for macOS to App Center | |
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'darwin' | |
run: | | |
yarn appcenter distribute release --disable-telemetry -t 1000000 \ | |
--token ${{ secrets.APPCENTER_DEPLOY_KEY }} \ | |
-a koishi/Koishi-Desktop-for-macOS \ | |
-g stable \ | |
-b ${{ steps.tag.outputs.build_version }} -n ${{ steps.tag.outputs.build_number }} \ | |
-f build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg | |
shell: bash |