From dd8bb923a8c66a6dfc5eadd61357e57722e83d2a Mon Sep 17 00:00:00 2001 From: Yanyutin753 <132346501+Yanyutin753@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:54:10 +0800 Subject: [PATCH] feat github action --- .github/workflows/docker-image.yml | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..bcd8fe5 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,46 @@ +name: ninja Build and Push Docker Image + +on: + release: + types: [created] + workflow_dispatch: + inputs: + tag: + description: 'Tag Name' + required: true + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Set tag name + id: tag_name + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" + elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "::set-output name=tag::${{ github.event.inputs.tag }}" + fi + + - name: Build and push Docker image with Release tag + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: | + vinlic/kimi-free-api:${{ steps.tag_name.outputs.tag }} + vinlic/kimi-free-api:latest + platforms: linux/amd64,linux/arm64 + build-args: TARGETPLATFORM=${{ matrix.platform }}