fix: fix the bug that show user information without any user login #582
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: | |
branches: | |
- master | |
paths: | |
- 'xmcl-runtime/**' | |
- 'xmcl-runtime-api/**' | |
- 'xmcl-keystone-ui/**' | |
- 'xmcl-electron-app/**' | |
- 'package.json' | |
- 'pnpm-lock.yaml' | |
- '.github/**' | |
# env: | |
# ELECTRON_CACHE: ~/.cache/electron | |
# ELECTRON_BUILDER_CACHE: ~/.cache/electron-builder | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: pnpm/[email protected] | |
with: | |
version: 8.3.0 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
# - name: Restore cached Electron | |
# id: cache-electron | |
# uses: actions/cache/restore@v3 | |
# with: | |
# path: | | |
# ~/.cache/electron | |
# ~/.cache/electron-builder | |
# key: ${{ runner.os }}-electron | |
- name: Install | |
run: pnpm install | |
- name: Build | |
run: | | |
pnpm run --prefix xmcl-keystone-ui build | |
pnpm run --prefix xmcl-electron-app build:all | |
env: | |
BUILD_NUMBER: ${{ github.run_number }} | |
NODE_ENV: production | |
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_TOKEN }} | |
WIN_CSC_LINK: ${{ secrets.CODE_SIGN_BASE64 }} | |
APPX_PUBLISHER: ${{ secrets.APPX_PUBLISHER }} | |
WIN_CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_PWD }} | |
# - name: Save cached Electron | |
# uses: actions/cache/save@v3 | |
# with: | |
# path: | | |
# ~/.cache/electron | |
# ~/.cache/electron-builder | |
# key: ${{ runner.os }}-electron | |
- name: Upload Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: | | |
xmcl-electron-app/build/output/ | |
- name: Upload Windows Zip Build | |
if: ${{ runner.os == 'Windows' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: win-b${{ github.run_number }} | |
path: | | |
xmcl-electron-app/build/output/win-unpacked/ | |
- name: Upload Linux x64 Zip Build | |
if: ${{ runner.os == 'Linux' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-b${{ github.run_number }}-x64 | |
path: | | |
xmcl-electron-app/build/output/linux-unpacked/ | |
- name: Upload Linux arm64 Zip Build | |
if: ${{ runner.os == 'Linux' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-b${{ github.run_number }}-arm64 | |
path: | | |
xmcl-electron-app/build/output/linux-arm64-unpacked/ | |
- name: Upload Mac x64 Zip Build | |
if: ${{ runner.os == 'macOS' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mac-b${{ github.run_number }}-x64 | |
path: | | |
xmcl-electron-app/build/output/mac/ | |
- name: Upload Mac arm64 Zip Build | |
if: ${{ runner.os == 'macOS' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mac-b${{ github.run_number }}-arm64 | |
path: | | |
xmcl-electron-app/build/output/mac-arm64/ | |
- name: Prepare Windows Asar | |
if: ${{ runner.os == 'Windows' && startsWith(github.event.head_commit.message, 'chore(release)') }} | |
run: | | |
mkdir asar | |
mv xmcl-electron-app/build/output/app.asar asar/app-win.asar | |
mv xmcl-electron-app/build/output/app.asar.sha256 asar/app-win.asar.sha256 | |
- name: Prepare macOS Asar | |
if: ${{ runner.os == 'macOS' && startsWith(github.event.head_commit.message, 'chore(release)') }} | |
run: | | |
mkdir asar | |
mv "xmcl-electron-app/build/output/app.asar" asar/app-mac.asar | |
mv "xmcl-electron-app/build/output/app-arm64.asar" asar/app-mac-arm64.asar | |
mv "xmcl-electron-app/build/output/app.asar.sha256" asar/app-mac.asar.sha256 | |
mv "xmcl-electron-app/build/output/app-arm64.asar.sha256" asar/app-mac-arm64.asar.sha256 | |
- name: Prepare Linux Asar | |
if: ${{ runner.os == 'Linux' && startsWith(github.event.head_commit.message, 'chore(release)') }} | |
run: | | |
mkdir asar | |
mv xmcl-electron-app/build/output/app.asar asar/app-linux.asar | |
mv xmcl-electron-app/build/output/app-arm64.asar asar/app-linux-arm64.asar | |
mv xmcl-electron-app/build/output/app.asar.sha256 asar/app-linux.asar.sha256 | |
mv xmcl-electron-app/build/output/app-arm64.asar.sha256 asar/app-linux-arm64.asar.sha256 | |
- name: Upload Asar | |
if: ${{ startsWith(github.event.head_commit.message, 'chore(release)') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: | | |
asar/*.* | |
prepare-release: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release)') }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: pnpm/[email protected] | |
with: | |
version: 8.3.0 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Install | |
run: | | |
pnpm install --filter ./.github/actions | |
- name: Bump Version | |
id: version | |
uses: Voxelum/semantic-version-bump-action@xmcl | |
with: | |
packages: | | |
./xmcl-keystone-ui | |
./xmcl-runtime | |
./xmcl-runtime-api | |
root: '.' | |
stage: 'prepare' | |
- name: Update Sponsor | |
uses: Voxelum/afdian-sponsor-action@master | |
with: | |
user-id: ${{ secrets.AFDIAN_USER_ID }} | |
token: ${{ secrets.AFDIAN_TOKEN }} | |
markdown: | | |
README.md | |
README.zh.md | |
- name: Update Lock File | |
if: ${{ steps.version.outputs.release == 'true' }} | |
run: pnpm i --lockfile-only | |
- name: Create Pull Request | |
if: ${{ steps.version.outputs.release == 'true' }} | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "chore(release): version ${{ steps.version.outputs.version }}" | |
title: Prepare Release ${{ steps.version.outputs.version }} | |
body: ${{ steps.version.outputs.changelog }} | |
reviewers: ci010 | |
assignees: ci010 | |
branch: prepare-release | |
release: | |
if: startsWith(github.event.head_commit.message, 'chore(release)') | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: pnpm/[email protected] | |
with: | |
version: 8.3.0 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Install | |
run: | | |
pnpm install --filter ./.github/actions | |
- name: Download Build | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: build | |
- name: Prepare Release | |
id: prepare_release | |
uses: Voxelum/semantic-version-bump-action@xmcl | |
with: | |
packages: | | |
./xmcl-keystone-ui | |
./xmcl-runtime | |
./xmcl-runtime-api | |
root: '.' | |
stage: 'release' | |
- name: Create Tag | |
run: | | |
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/voxelum/x-minecraft-launcher.git" | |
git config user.name ci010 | |
git config user.email [email protected] | |
git tag -f ${{ steps.prepare_release.outputs.tag }} | |
git push origin tag ${{ steps.prepare_release.outputs.tag }} -f | |
- name: Rename asar | |
run: | | |
mv ./build/app-win.asar ./build/app-${{ steps.prepare_release.outputs.version }}-win.asar | |
mv ./build/app-mac.asar ./build/app-${{ steps.prepare_release.outputs.version }}-mac.asar | |
mv ./build/app-mac-arm64.asar ./build/app-${{ steps.prepare_release.outputs.version }}-mac-arm64.asar | |
mv ./build/app-linux.asar ./build/app-${{ steps.prepare_release.outputs.version }}-linux.asar | |
mv ./build/app-linux-arm64.asar ./build/app-${{ steps.prepare_release.outputs.version }}-linux-arm64.asar | |
mv ./build/app-win.asar.sha256 ./build/app-${{ steps.prepare_release.outputs.version }}-win.asar.sha256 | |
mv ./build/app-mac.asar.sha256 ./build/app-${{ steps.prepare_release.outputs.version }}-mac.asar.sha256 | |
mv ./build/app-mac-arm64.asar.sha256 ./build/app-${{ steps.prepare_release.outputs.version }}-mac-arm64.asar.sha256 | |
mv ./build/app-linux.asar.sha256 ./build/app-${{ steps.prepare_release.outputs.version }}-linux.asar.sha256 | |
mv ./build/app-linux-arm64.asar.sha256 ./build/app-${{ steps.prepare_release.outputs.version }}-linux-arm64.asar.sha256 | |
- name: Emit Version File | |
run: | | |
echo ${{ steps.prepare_release.outputs.version }}.${{ github.run_number }} > ./build/version | |
- name: Draft Release | |
id: create_release | |
uses: voxelum/create-release@xmcl | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.prepare_release.outputs.tag }} | |
release_name: ${{ steps.prepare_release.outputs.tag }} | |
draft: true | |
prerelease: false | |
body: ${{ steps.prepare_release.outputs.changelog }} | |
asset_dir_path: ./build | |
- name: Checkout Website | |
uses: actions/checkout@v3 | |
with: | |
repository: Voxelum/xmcl-page | |
path: xmcl-page | |
- name: Create Release Note | |
uses: ./.github/actions/generate-release-note | |
with: | |
body: ${{ steps.prepare_release.outputs.changelog }} | |
version: ${{ steps.prepare_release.outputs.version }} | |
- name: Create Release Note PR | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.PAT_GITHUB_TOKEN }} | |
path: xmcl-page | |
commit-message: "docs: Update ${{ steps.prepare_release.outputs.version }} release note" | |
title: Update ${{ steps.prepare_release.outputs.version }} release note | |
body: Update ${{ steps.prepare_release.outputs.version }} release note | |
reviewers: ci010 | |
assignees: ci010 | |
branch: release-note-${{ steps.prepare_release.outputs.version }} |