Jixun Wu
2 years ago
committed by
Gitea
6 changed files with 135 additions and 432 deletions
@ -1,84 +0,0 @@ |
|||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json |
|
||||
|
|
||||
name: Test Build |
|
||||
on: |
|
||||
push: |
|
||||
paths: |
|
||||
- ".github/workflows/*" |
|
||||
- "**/*.js" |
|
||||
- "**/*.ts" |
|
||||
- "**/*.vue" |
|
||||
- "public/**/*" |
|
||||
- "package-lock.json" |
|
||||
- "package.json" |
|
||||
pull_request: |
|
||||
branches: [ master ] |
|
||||
types: [ opened, synchronize, reopened ] |
|
||||
paths: |
|
||||
- "**/*.js" |
|
||||
- "**/*.ts" |
|
||||
- "**/*.vue" |
|
||||
- "public/**/*" |
|
||||
- "package-lock.json" |
|
||||
- "package.json" |
|
||||
|
|
||||
|
|
||||
jobs: |
|
||||
test-coverage: |
|
||||
runs-on: ubuntu-latest |
|
||||
steps: |
|
||||
- uses: actions/checkout@v2 |
|
||||
- run: npm ci |
|
||||
# note: forks can not access to GITHUB_TOKEN for coverage update. |
|
||||
# instead, we just ran the test in this case. |
|
||||
- name: Test only |
|
||||
if: github.event_name != 'push' |
|
||||
run: npm test |
|
||||
- name: Test + Publish Coverage |
|
||||
uses: ArtiomTr/jest-coverage-report-action@v2.0-rc.6 |
|
||||
if: github.event_name == 'push' |
|
||||
with: |
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }} |
|
||||
annotations: none |
|
||||
build: |
|
||||
runs-on: ubuntu-latest |
|
||||
strategy: |
|
||||
matrix: |
|
||||
build: [ legacy, modern ] |
|
||||
include: |
|
||||
- build: legacy |
|
||||
BUILD_ARGS: "" |
|
||||
BUILD_EXTENSION: true |
|
||||
- build: modern |
|
||||
BUILD_ARGS: "-- --modern" |
|
||||
BUILD_EXTENSION: false |
|
||||
steps: |
|
||||
- uses: actions/checkout@v2 |
|
||||
|
|
||||
- name: Use Node.js 16.x |
|
||||
uses: actions/setup-node@v2 |
|
||||
with: |
|
||||
node-version: "16" |
|
||||
|
|
||||
- name: Install Dependencies |
|
||||
run: npm ci |
|
||||
|
|
||||
- name: Build |
|
||||
run: npm run build ${{ matrix.BUILD_ARGS }} |
|
||||
|
|
||||
- name: Publish artifact |
|
||||
uses: actions/upload-artifact@v2 |
|
||||
with: |
|
||||
name: ${{ matrix.build }} |
|
||||
path: ./dist |
|
||||
|
|
||||
- name: Build Extension |
|
||||
if: ${{ matrix.BUILD_EXTENSION }} |
|
||||
run: npm run make-extension |
|
||||
|
|
||||
- name: Publish artifact - Extension |
|
||||
if: ${{ matrix.BUILD_EXTENSION }} |
|
||||
uses: actions/upload-artifact@v2 |
|
||||
with: |
|
||||
name: extension |
|
||||
path: ./dist |
|
@ -1,65 +0,0 @@ |
|||||
name: Post Release |
|
||||
on: |
|
||||
release: |
|
||||
types: [ published ] |
|
||||
jobs: |
|
||||
release-docker: |
|
||||
runs-on: ubuntu-latest |
|
||||
steps: |
|
||||
- uses: actions/checkout@v2 |
|
||||
|
|
||||
- name: Setup vars |
|
||||
id: vars |
|
||||
env: |
|
||||
RELEASE_REF: ${{ github.ref }} |
|
||||
run: echo "::set-output name=tag::${RELEASE_REF#refs/tags/}" |
|
||||
|
|
||||
- name: Download release content |
|
||||
run: | |
|
||||
echo "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" |
|
||||
wget -O modern.tar.gz "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" |
|
||||
mkdir ./dist |
|
||||
tar zxf modern.tar.gz -C ./dist |
|
||||
|
|
||||
- name: Set up Docker Buildx |
|
||||
uses: docker/setup-buildx-action@v1 |
|
||||
|
|
||||
- name: Login to DockerHub |
|
||||
uses: docker/login-action@v1 |
|
||||
with: |
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }} |
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
|
||||
|
|
||||
- name: Build docker and push (on modern) |
|
||||
uses: docker/build-push-action@v2 |
|
||||
with: |
|
||||
context: . |
|
||||
file: ./Dockerfile |
|
||||
platforms: linux/amd64,linux/arm64,linux/386 |
|
||||
push: true |
|
||||
tags: | |
|
||||
ix64/unlock-music:latest |
|
||||
ix64/unlock-music:${{ steps.vars.outputs.tag }} |
|
||||
|
|
||||
gh-pages: |
|
||||
runs-on: ubuntu-latest |
|
||||
steps: |
|
||||
- name: Setup vars |
|
||||
id: vars |
|
||||
env: |
|
||||
RELEASE_REF: ${{ github.ref }} |
|
||||
run: echo "::set-output name=tag::${RELEASE_REF#refs/tags/}" |
|
||||
|
|
||||
- name: Download release content |
|
||||
run: | |
|
||||
echo "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" |
|
||||
wget -O modern.tar.gz "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" |
|
||||
mkdir ./dist |
|
||||
tar zxf modern.tar.gz -C ./dist |
|
||||
|
|
||||
- name: Deploy |
|
||||
uses: peaceiris/actions-gh-pages@v3 |
|
||||
with: |
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }} |
|
||||
publish_dir: ./dist |
|
||||
|
|
@ -1,126 +0,0 @@ |
|||||
name: Build Release |
|
||||
|
|
||||
on: |
|
||||
push: |
|
||||
tags: |
|
||||
- "v*" |
|
||||
|
|
||||
jobs: |
|
||||
build: |
|
||||
runs-on: ubuntu-latest |
|
||||
steps: |
|
||||
- uses: actions/checkout@v2 |
|
||||
|
|
||||
- name: Use Node.js 16.x |
|
||||
uses: actions/setup-node@v2 |
|
||||
with: |
|
||||
node-version: "16" |
|
||||
|
|
||||
- name: Install Dependencies |
|
||||
run: npm ci |
|
||||
|
|
||||
- name: Build Legacy |
|
||||
env: |
|
||||
GZIP: "--best" |
|
||||
run: | |
|
||||
npm run build |
|
||||
tar -czf legacy.tar.gz -C ./dist . |
|
||||
cd dist |
|
||||
zip -rJ9 ../legacy.zip * |
|
||||
cd .. |
|
||||
|
|
||||
- name: Build Extension (on legacy) |
|
||||
env: |
|
||||
GZIP: "--best" |
|
||||
run: | |
|
||||
npm run make-extension |
|
||||
cd dist |
|
||||
zip -rJ9 ../extension.zip * |
|
||||
cd .. |
|
||||
|
|
||||
- name: Build Modern |
|
||||
env: |
|
||||
GZIP: "--best" |
|
||||
run: | |
|
||||
npm run build -- --modern |
|
||||
tar -czf modern.tar.gz -C ./dist . |
|
||||
cd dist |
|
||||
zip -rJ9 ../modern.zip * |
|
||||
cd .. |
|
||||
|
|
||||
- name: Checksum |
|
||||
run: sha256sum *.tar.gz *.zip > sha256sum.txt |
|
||||
|
|
||||
- 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: |
|
||||
tag_name: ${{ github.ref }} |
|
||||
release_name: "Build ${{ steps.date.outputs.date }}" |
|
||||
draft: true |
|
||||
|
|
||||
- name: Upload Release Assets - legacy.tar.gz |
|
||||
uses: actions/upload-release-asset@v1 |
|
||||
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: Upload Release Assets - legacy.zip |
|
||||
uses: actions/upload-release-asset@v1 |
|
||||
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: Upload Release Assets - modern.tar.gz |
|
||||
uses: actions/upload-release-asset@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 |
|
||||
|
|
||||
- name: Upload Release Assets - modern.zip |
|
||||
uses: actions/upload-release-asset@v1 |
|
||||
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 - extension.zip |
|
||||
uses: actions/upload-release-asset@v1 |
|
||||
env: |
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
||||
with: |
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }} |
|
||||
asset_path: ./extension.zip |
|
||||
asset_name: extension.zip |
|
||||
asset_content_type: application/zip |
|
||||
|
|
||||
- name: Upload Release Assets - sha256sum.txt |
|
||||
uses: actions/upload-release-asset@v1 |
|
||||
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