From 802b016e5aba65991fb70220c85f0e04b0d9c012 Mon Sep 17 00:00:00 2001 From: ss1917 <191715030@qq.com> Date: Thu, 6 Jun 2024 15:04:07 +0800 Subject: [PATCH] Create build.yaml --- .github/workflows/build.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 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..8405e03 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,28 @@ +name: Build and Push Docker Image to Alibaba Cloud + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Alibaba Cloud Container Registry + env: + DOCKER_REGISTRY: ${{ secrets.ALICLOUD_REGISTRY }} + DOCKER_USERNAME: ${{ secrets.ALICLOUD_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.ALICLOUD_PASSWORD }} + run: | + echo $DOCKER_PASSWORD | docker login --username=$DOCKER_USERNAME --password-stdin $DOCKER_REGISTRY + + - name: Build Docker image + run: docker build -t ${{ secrets.ALICLOUD_REGISTRY }}/codo-admin:latest . + + - name: Push Docker image + run: docker push ${{ secrets.ALICLOUD_REGISTRY }}/codo-admin:latest