From 825371da53af36ff8e082885645154247228d356 Mon Sep 17 00:00:00 2001 From: ShellWen Date: Sun, 26 Nov 2023 02:50:10 +0800 Subject: [PATCH] :construction_worker: Add GitHub Actions --- .github/workflows/build.yaml | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..a6ebd0b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,50 @@ +name: Build +on: + workflow_dispatch: + push: + branches: + - master +jobs: + build: + concurrency: + group: build-global-${{ github.ref }} + cancel-in-progress: true + runs-on: ubuntu-latest + environment: production + steps: + - uses: actions/checkout@v3 + + - uses: benjlevesque/short-sha@v2.1 + id: short-sha + with: + length: 7 + + - name: Login to Docker + uses: docker/login-action@v2 + with: + registry: registry.ap-southeast-1.aliyuncs.com + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build docker image and push [ap-southeast-1] + uses: docker/build-push-action@v3 + with: + push: true + context: . + tags: registry.ap-southeast-1.aliyuncs.com/kemono/maintenance:main-${{ env.SHA }} + file: Dockerfile + + - name: Login to Docker + uses: docker/login-action@v2 + with: + registry: registry.cn-shenzhen.aliyuncs.com + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build docker image and push [cn-shenzhen] + uses: docker/build-push-action@v3 + with: + push: true + context: . + tags: registry.cn-shenzhen.aliyuncs.com/kemono/maintenance:main-${{ env.SHA }} + file: Dockerfile