diff options
| author | MetaCubeX <[email protected]> | 2022-05-27 03:56:06 +0800 |
|---|---|---|
| committer | MetaCubeX <[email protected]> | 2022-05-27 03:56:06 +0800 |
| commit | 6533ca55d704ea511e377f6048ebf99025e4b351 (patch) | |
| tree | 705e2d32b23d09b63ca0c15149aa65d5f56e1096 | |
| parent | 414a95687df08270d16f9b7fc2bbb9a66bd5163e (diff) | |
chore: workflows
| -rw-r--r-- | .github/workflows/push.yml | 93 |
1 files changed, 22 insertions, 71 deletions
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index aa5ac8d..341e876 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,79 +1,30 @@ +name: Deploy + on: [push] -name: Deploy workflow -concurrency: - group: build-${{ github.ref }} - cancel-in-progress: true -jobs: - install: - runs-on: ubuntu-20.04 - strategy: - matrix: - node-version: [16.x] +jobs: + build: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - name: Checkout Dashboard code + uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 with: - node-version: ${{ matrix.node-version }} - - - name: Cache pnpm modules - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}- - - uses: pnpm/[email protected] + version: latest + - name: Setup Nodejs + uses: actions/setup-node@v3 with: - version: 7 - run_install: true - - - name: Lint - run: pnpm lint - - name: Build - run: pnpm build - - - name: Create Release - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + node-version: '17.x' + cache: pnpm + - name: Install package and build + run: | + pnpm install + pnpm build + - name: Deploy + uses: crazy-max/ghaction-github-pages@v2 with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: true - prerelease: false - - name: Create Tar Ball - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') - run: tar cJf yacd.tar.xz public - - name: Upload Release Asset - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') - id: upload-release-asset - uses: actions/upload-release-asset@v1 + target_branch: gh-pages + build_dir: public + fqdn: yacd.metacubex.one env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./yacd.tar.xz - asset_name: yacd.tar.xz - asset_content_type: application/x-gzip - - - name: Push to gh-pages - - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} - PUBLISH_DIR: public - BRANCH: gh-pages - run: | - cd $PUBLISH_DIR - ls -l - git init - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@noreply.github.com" - git add . - git status - git commit -m "Push to gh-pages" - git push -f https://$GITHUB_ACTOR:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:$BRANCH |
