forked from um/web
Update CI
This commit is contained in:
parent
fbdad625c5
commit
60e2039e56
67
.github/workflows/build.yml
vendored
Normal file
67
.github/workflows/build.yml
vendored
Normal file
@ -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
|
181
.github/workflows/release.yml
vendored
181
.github/workflows/release.yml
vendored
@ -3,104 +3,119 @@ name: Release and GitHub Pages
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js 12.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Use Node.js 14.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.x
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
npm ci
|
||||
npm run fix-compatibility
|
||||
- name: Build Legacy
|
||||
run: |
|
||||
npm run build
|
||||
tar -czf legacy.tar.gz -C ./dist .
|
||||
zip -rJ9 legacy.zip ./dist
|
||||
- name: Build Modern
|
||||
run: |
|
||||
npm run build -- --modern
|
||||
tar -czf modern.tar.gz -C ./dist .
|
||||
zip -rJ9 modern.zip ./dist
|
||||
- run: sha256sum *.tar.gz *.zip > sha256sum.txt
|
||||
- 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: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./dist
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
npm ci
|
||||
npm run fix-compatibility
|
||||
|
||||
- name: Get current time
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y/%m/%d')"
|
||||
- name: Build Legacy
|
||||
env:
|
||||
GZIP: "--best"
|
||||
run: |
|
||||
npm run build
|
||||
tar -czf legacy.tar.gz -C ./dist .
|
||||
zip -rJ9 legacy.zip ./dist
|
||||
|
||||
- name: Create a Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: "Build ${{ steps.date.outputs.date }}"
|
||||
draft: true
|
||||
- name: Build Modern
|
||||
env:
|
||||
GZIP: "--best"
|
||||
run: |
|
||||
npm run build -- --modern
|
||||
tar -czf modern.tar.gz -C ./dist .
|
||||
zip -rJ9 modern.zip ./dist
|
||||
|
||||
- name: Upload Release Assets - legacy.tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./legacy.tar.gz
|
||||
asset_name: legacy.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
- name: Checksum
|
||||
run: sha256sum *.tar.gz *.zip > sha256sum.txt
|
||||
|
||||
- name: Upload Release Assets - legacy.zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./legacy.zip
|
||||
asset_name: legacy.zip
|
||||
asset_content_type: application/zip
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./dist
|
||||
|
||||
- name: Upload Release Assets - modern.tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
- name: Get current time
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y/%m/%d')"
|
||||
|
||||
- name: Create a Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./modern.tar.gz
|
||||
asset_name: modern.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: "Build ${{ steps.date.outputs.date }}"
|
||||
draft: true
|
||||
|
||||
- name: Upload Release Assets - modern.zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
- name: Upload Release Assets - legacy.tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./modern.zip
|
||||
asset_name: modern.zip
|
||||
asset_content_type: application/zip
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./legacy.tar.gz
|
||||
asset_name: legacy.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
|
||||
- name: Upload Release Assets - sha256sum.txt
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
- name: Upload Release Assets - legacy.zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./sha256sum.txt
|
||||
asset_name: sha256sum.txt
|
||||
asset_content_type: text/plain
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./legacy.zip
|
||||
asset_name: legacy.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Release Assets - modern.tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./modern.tar.gz
|
||||
asset_name: modern.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
|
||||
- name: Upload Release Assets - modern.zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./modern.zip
|
||||
asset_name: modern.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Release Assets - sha256sum.txt
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./sha256sum.txt
|
||||
asset_name: sha256sum.txt
|
||||
asset_content_type: text/plain
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user