Skip to content

Merge branch 'fix-spell' of https://github.com/nervosnetwork/neuron i… #888

Merge branch 'fix-spell' of https://github.com/nervosnetwork/neuron i…

Merge branch 'fix-spell' of https://github.com/nervosnetwork/neuron i… #888

name: Package Neuron for Test
on:
pull_request:
push:
jobs:
packaging:
strategy:
matrix:
node:
- 18.12.0
os:
- macos-latest
- ubuntu-20.04
- windows-2019
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}(Node.js ${{ matrix.node }})
env:
MAC_SHOULD_CODE_SIGN: ${{ github.event_name != 'pull_request' && secrets.APPLE_ID != '' }}
WIN_CERTIFICATE_BASE64: ${{ secrets.WIN_CERTIFICATE_BASE64 }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Restore
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: 2022-12-21-${{ runner.os }}-${{ hashFiles('**/yarn.lock')}}
- name: Add msbuild to PATH
if: matrix.os == 'windows-2019'
uses: microsoft/setup-msbuild@v1.3.1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Install libudev
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- name: Install Lerna
run: yarn global add lerna
- name: Boostrap
run: |
yarn
env:
CI: false
- name: Package for MacOS
if: ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'true' }}
run: |
./scripts/download-ckb.sh mac
yarn package:test mac
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
CSC_LINK: ${{ secrets.MAC_CERTIFICATE_BASE64 }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
- name: Package for MacOS for skip code sign
if: ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'false' }}
run: |
export CSC_IDENTITY_AUTO_DISCOVERY=false
./scripts/download-ckb.sh mac
yarn package:test mac
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_NOTARIZE: true
- name: Package for Windows
if: ${{ matrix.os == 'windows-2019' && env.WIN_CERTIFICATE_BASE64 != '' }}
run: |
bash ./scripts/download-ckb.sh win
yarn build
bash ./scripts/copy-ui-files.sh
bash ./scripts/package-for-test.sh win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.WIN_CERTIFICATE_BASE64 }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERTIFICATE_PASSWORD }}
- name: Package for Windows for skip code sign
if: ${{ matrix.os == 'windows-2019' && env.WIN_CERTIFICATE_BASE64 == '' }}
run: |
bash ./scripts/download-ckb.sh win
yarn build
bash ./scripts/copy-ui-files.sh
bash ./scripts/package-for-test.sh win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Package for Linux
if: matrix.os == 'ubuntu-20.04'
run: |
./scripts/download-ckb.sh
yarn package:test linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Neuron App Zip
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Mac-x64
path: release/Neuron-*-mac-x64.zip
- name: Upload Neuron App Zip(arm64)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Mac-arm64
path: release/Neuron-*-mac-arm64.zip
- name: Upload Neuron Dmg
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Dmg-x64
path: release/Neuron-*-x64.dmg
- name: Upload Neuron Dmg(arm64)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Dmg-arm64
path: release/Neuron-*-arm64.dmg
- name: Upload Neuron Win
if: matrix.os == 'windows-2019'
uses: actions/upload-artifact@v3
with:
name: Neuron-Win
path: release/Neuron-*-setup.exe
- name: Upload Neuron Linux
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: Neuron-Linux
path: release/Neuron-*.AppImage
cache-package-info:
needs: [packaging]
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Save PR number and run id
env:
PR_NUMBER: ${{ github.event.number }}
RUN_ID: ${{ github.run_id }}
SHA: ${{ github.event.pull_request.head.sha }}
run: |
mkdir -p ./package_info
echo $PR_NUMBER > ./package_info/pr_number
echo $RUN_ID > ./package_info/run_id
echo $SHA > ./package_info/sha
- uses: actions/upload-artifact@v3
with:
name: package_info
path: package_info/
retention-days: 3
comment:
needs: [packaging]
# During a pull_request event triggered by a forked repository, actions have no write access to GitHub resources and will fail on any attempt.
# ref https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#restrictions-on-repository-forks
if: ${{ github.event_name == 'push' }}
name: Append links to the Pull Request
runs-on: ubuntu-latest
steps:
- uses: peter-evans/commit-comment@v2
with:
body: |
Packaging for test is done in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})