From 35d302db7b8f46937b8efe9f5dc9d7e1ead0ad27 Mon Sep 17 00:00:00 2001 From: zhen peng <505380967@qq.com> Date: Thu, 16 Jan 2025 16:54:34 +0800 Subject: [PATCH] ci: add release ci (#19) * ci: add release ci --------- Co-authored-by: pengzhen --- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ddfa4d0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: shisui release image + +on: + release: + types: [created] + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +env: + releaseBuild: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} + REGISTRY: ghcr.io + TAG_NAME: ${{ github.ref | replace('refs/tags/', '') }} + +jobs: + push_image_to_github: + name: Push Docker image to Github + runs-on: ubuntu-latest + permissions: write-all + if: ${{ env.releaseBuild == 'true' }} # Only run this job if releaseBuild is true + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG_NAME }} \ No newline at end of file