From d9b8fd59f0ebad404b88a728b150936bab742266 Mon Sep 17 00:00:00 2001 From: liyp Date: Sat, 29 Apr 2023 22:00:31 +0800 Subject: [PATCH] test action 1 --- .github/workflows/build.yaml | 19 ++++ .github/workflows/push.yml | 174 ----------------------------------- 2 files changed, 19 insertions(+), 174 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..ee634c3 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,19 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - run: echo "🍏 This job's status is ${{ gitea.status }}." + diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 33585ce..0000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,174 +0,0 @@ -on: [push] -name: Deploy workflow -concurrency: - group: build-${{ github.ref }} - cancel-in-progress: true -jobs: - install: - runs-on: ubuntu-latest - permissions: - contents: write - # https://github.com/actions/deploy-pages - pages: write - id-token: write - strategy: - matrix: - node-version: [16.x] - - steps: - - 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/action-setup@v2.2.4 - with: - version: 7 - run_install: true - - - name: Lint - run: pnpm lint - - name: Set git commit sha - id: revparse - run: | - echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - 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.GITHUB_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" - touch .nojekyll - 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-latest - 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: Set git commit sha - id: revparse - run: | - echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - - 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/setup-qemu-action@v1.2.0 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - with: - version: latest - - - name: Builder instance name - run: echo ${{ steps.buildx.outputs.name }} - - name: Available platforms - run: echo ${{ steps.buildx.outputs.platforms }} - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ github.actor }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Login to GHCR - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v3 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64 - push: true - tags: ${{ steps.docker_meta.outputs.tags }},ghcr.io/${{ steps.docker_meta.outputs.tags }} - labels: ${{ steps.docker_meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha - build-args: | - COMMIT_HASH=${{ env.COMMIT_HASH }} - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} - - - name: Send Notification - uses: haishanh/actions-telegram-notification@v1 - if: ${{ always() }} - with: - notification-token: ${{ secrets.TG_NOTIFICATION_TOKEN }} - job-status: ${{ job.status }}