Browse Source

Update CI

20230320
MengYX 4 years ago
parent
commit
60e2039e56
No known key found for this signature in database GPG Key ID: E63F9C7303E8F604
  1. 67
      .github/workflows/build.yml
  2. 27
      .github/workflows/release.yml

67
.github/workflows/build.yml

@ -0,0 +1,67 @@
name: Build
on:
push:
branches: [ master ]
paths:
- "**/*.js"
- "**/*.vue"
- "public/**/*"
- "package-lock.json"
- "package.json"
pull_request:
branches: [ master ]
types: [ opened, synchronize, reopened ]
paths:
- "**/*.js"
- "**/*.vue"
- "public/**/*"
- "package-lock.json"
- "package.json"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
build: [ legacy, modern ]
include:
- build: legacy
BUILD_ARGS:
- build: modern
BUILD_ARGS: "-- --modern"
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install Dependencies
run: |
npm ci
npm run fix-compatibility
- name: Build
env:
GZIP: "--best"
run: |
npm run build ${{ matrix.BUILD_ARGS }}
tar -czvf dist.tar.gz -C ./dist .
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: unlock-music-${{ matrix.build }}.tar.gz
path: ./dist.tar.gz

27
.github/workflows/release.yml

@ -7,32 +7,47 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Use Node.js 12.x - name: Use Node.js 14.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install Dependencies - name: Install Dependencies
run: | run: |
npm ci npm ci
npm run fix-compatibility npm run fix-compatibility
- name: Build Legacy - name: Build Legacy
env:
GZIP: "--best"
run: | run: |
npm run build npm run build
tar -czf legacy.tar.gz -C ./dist . tar -czf legacy.tar.gz -C ./dist .
zip -rJ9 legacy.zip ./dist zip -rJ9 legacy.zip ./dist
- name: Build Modern - name: Build Modern
env:
GZIP: "--best"
run: | run: |
npm run build -- --modern npm run build -- --modern
tar -czf modern.tar.gz -C ./dist . tar -czf modern.tar.gz -C ./dist .
zip -rJ9 modern.zip ./dist zip -rJ9 modern.zip ./dist
- run: sha256sum *.tar.gz *.zip > sha256sum.txt
- name: Checksum
run: sha256sum *.tar.gz *.zip > sha256sum.txt
- name: Deploy - name: Deploy
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3

Loading…
Cancel
Save