Skip to content

Commit

Permalink
feat: Enable experimental linux arm64 build for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Dec 22, 2022
1 parent f581d11 commit 6a15a89
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 74 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on:
push:
branches:
- instance-share
paths:
- 'xmcl-runtime/**'
- 'xmcl-runtime-api/**'
- 'xmcl-keystone-ui/**'
- 'xmcl-electron-app/**'
- 'package.json'
- 'pnpm-lock.yaml'
- '.github/**'

jobs:
build-linux-arm64:
runs-on: ubuntu-22.04
name: linux arm64
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: uraimo/run-on-arch-action@v2
name: Build and deploy Maverick on Linux-ARM64
id: build
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
shell: /bin/bash
env: |
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_TOKEN }}
install: |
apt-get update -q -y
apt-get install -q -y git
apt install -q -y wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
wget http://launchpadlibrarian.net/611219191/libssl1.1_1.1.1f-1ubuntu2.16_arm64.deb
dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_arm64.deb
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 18.12.1
nvm alias default 18.12.1
nvm use default
apt install -q -y npm
npm install -g pnpm
run: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm use 18.12.1 && \
pnpm install --filter=!./xmcl-page && \
pnpm run --prefix xmcl-keystone-ui build && \
pnpm run --prefix xmcl-electron-app build:all
- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: linux-arm64
path: |
xmcl-electron-app/build/output/*.*
58 changes: 0 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,8 @@ jobs:
with:
node-version: 16
cache: 'pnpm'
# - name: Cache electron builder
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache/electron
# ~/.cache/electron-builder
# key: ${{ runner.os }}
- name: Install
run: pnpm install --filter=!./xmcl-page
# - name: Lint
# run: |
# npm run lint
- name: Build
run: |
pnpm run --prefix xmcl-keystone-ui build
Expand All @@ -51,8 +41,6 @@ jobs:
BUILD_NUMBER: ${{ env.GITHUB_RUN_NUMBER }}
NODE_ENV: production
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_TOKEN }}
# ELECTRON_CACHE: ~/.cache/electron
# ELECTRON_BUILDER_CACHE: ~/.cache/electron-builder
- name: Upload Build
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -156,52 +144,6 @@ jobs:
path: |
xmcl-electron-app/build/output/*.*
build-linux-arm64:
runs-on: ubuntu-22.04
name: Build on ubuntu22.04 aarch64

steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
name: Build and deploy Maverick on Linux-ARM64
id: build
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
shell: /bin/bash
env: |
BUILD_NUMBER: ${{ env.GITHUB_RUN_NUMBER }}
NODE_ENV: production
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_TOKEN }}
install: |
apt-get update -q -y
apt-get install -q -y git
apt install -q -y wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 18.12.0
nvm alias default 18.12.0
nvm use default
apt install -q -y npm
npm install -g pnpm
run: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm use 18.12.0 && \
pnpm install && \
pnpm run --prefix xmcl-keystone-ui build && \
pnpm run --prefix xmcl-electron-app build
- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: linux-arm64
path: |
xmcl-electron-app/build/output/*.*
prepare-release:
runs-on: ubuntu-latest
needs:
Expand Down
19 changes: 3 additions & 16 deletions xmcl-electron-app/build/electron-builder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,14 @@ export const config: Configuration = {
category: 'Game',
icon: 'icons/dark@256x256.png',
// eslint-disable-next-line no-template-curly-in-string
artifactName: 'xmcl-${version}.${ext}',
artifactName: 'xmcl-${version}-${arch}.${ext}',
target: process.env.BUILD_TARGET === 'appimage'
? 'AppImage'
: [
{
target: 'deb',
arch: [
'arm64',
'x64',
],
},
'deb',
'rpm',
'snap',
'zip',
{
target: 'tar.xz',
arch: [
'arm64',
'x64',
],
},
'tar.xz',
],
},
snap: {
Expand Down

0 comments on commit 6a15a89

Please sign in to comment.