mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-04-14 02:10:31 +08:00
77 lines
2.2 KiB
YAML
77 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
env:
|
|
TZ: Asia/Shanghai
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v1
|
|
- uses: actions/cache@v2
|
|
id: cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
- run: yarn install --frozen-lockfile
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
- run: yarn run lint
|
|
- run: yarn run test:unit
|
|
|
|
build:
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push'
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v1
|
|
- uses: actions/cache@v2
|
|
id: cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
- run: yarn install --frozen-lockfile
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
- run: echo ::set-env name=COMMIT_ID::$(echo ${{ github.sha }} | cut -c -6)
|
|
- run: echo ::set-env name=GIT_TAG::nightly-$COMMIT_ID
|
|
- run: echo ::set-env name=RELEASE_TITLE::$(date +'%Y%m%d-%H%M%S')
|
|
- run: echo ::set-env name=RELEASE_FILE::qb-web-$RELEASE_TITLE.zip
|
|
- name: Pack Release
|
|
run: |
|
|
yarn run build
|
|
# see https://github.com/qbittorrent/qBittorrent/pull/10485, fixed in qb v4.2.0
|
|
cp dist/public/{index,login}.html
|
|
cp INSTALL.md dist
|
|
zip -r $RELEASE_FILE dist
|
|
- name: Add tag
|
|
run: |
|
|
git tag $GIT_TAG
|
|
git push origin $GIT_TAG
|
|
- id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.GIT_TAG }}
|
|
release_name: ${{ env.RELEASE_TITLE }}
|
|
prerelease: true
|
|
- uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ${{ env.RELEASE_FILE }}
|
|
asset_name: ${{ env.RELEASE_FILE }}
|
|
asset_content_type: application/zip
|