From a8c74523da6b1f55253ea3eb1df69f46e3e91d96 Mon Sep 17 00:00:00 2001 From: Dream Hunter Date: Thu, 18 Jul 2024 00:56:53 +0800 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 39 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66e2701..c34c158 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,30 +3,35 @@ name: Docker Image Release on: push: tags: - - '*.*.*' + - "*.*.*" -jobs: +env: + REGISTRY: ghcr.io +jobs: build: - runs-on: ubuntu-latest steps: - - name: Get version - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive - - name: Docker Login - uses: docker/login-action@v1.8.0 + - name: Log in to the Container registry + uses: docker/login-action@v3 with: - registry: dreamhunter2333.azurecr.io - username: ${{ secrets.AZURE_REGISTRY_USERNAME }} - password: ${{ secrets.AZURE_REGISTRY_PASSWORD }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Build the Docker image - run: docker build . --file docker/dockerfile --tag dreamhunter2333.azurecr.io/awsl/telebot:${{ steps.get_version.outputs.VERSION }} - - name: Push the Docker image - run: docker push dreamhunter2333.azurecr.io/awsl/telebot:${{ steps.get_version.outputs.VERSION }} + - name: Build and push Docker images + uses: docker/build-push-action@v5 + with: + context: . + file: docker/dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }} + ${{ env.REGISTRY }}/${{ github.repository }}:latest