diff options
| author | Matain <[email protected]> | 2022-06-12 23:34:56 +0800 |
|---|---|---|
| committer | Matain <[email protected]> | 2022-06-12 23:34:56 +0800 |
| commit | ea5d7cf003eeef30cb7bbe789c6ba7f314bf1ce4 (patch) | |
| tree | bff1bd7b0e8e8eb753d373b57f007bbe97f96c76 /.github/workflows | |
| parent | 4fd2c8f646e48dd0c07d0c2041de52e9a4f8bc82 (diff) | |
| parent | 38571da24ac54137564be5e41b7a409009e2ee10 (diff) | |
Merge branch 'master' of https://github.com/haishanh/yacd into haishanh-master
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/push.yml | 105 |
1 files changed, 102 insertions, 3 deletions
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 341e876..658da3c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -6,9 +6,108 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout Dashboard code - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + 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] + 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 }} + 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 + 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 + if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/') || github.event.ref == 'refs/heads/publish') + 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 + + - name: Send Notification + uses: haishanh/actions-telegram-notification@v1 + if: ${{ always() }} + with: + notification-token: ${{ secrets.TG_NOTIFICATION_TOKEN }} + job-status: ${{ job.status }} + + docker: + needs: install + runs-on: ubuntu-20.04 + if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/') || startsWith(github.event.ref, 'refs/heads/v0.') || github.event.ref == 'refs/heads/master' || github.event.ref == 'refs/heads/test') + steps: + - uses: actions/checkout@v3 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v4 + with: + images: haishanh/yacd + + # - name: Set up QEMU + # uses: docker/[email protected] + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 with: version: latest - name: Setup Nodejs |
