From d93f63240fe416fbc6c949801f3a607e00d18871 Mon Sep 17 00:00:00 2001 From: "xiarui.xr" Date: Mon, 11 Sep 2023 14:56:43 +0800 Subject: [PATCH 1/2] chore: add docker release workflow --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 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 00000000..315c6da3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: release +on: + push: + branches: + - "main" + tags: + - "v*" +permissions: + contents: write +jobs: + release: + name: Build and release + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + # kcl-go build + - name: Build kcl-go + run: GOOS=linux GOARCH=amd64 go build ./cmds/kcl-go + shell: bash + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: kcllang/kcl-go + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 51b5badb4ca469af16b7aafe7e270a58648dc7a2 Mon Sep 17 00:00:00 2001 From: "xiarui.xr" Date: Mon, 11 Sep 2023 15:48:00 +0800 Subject: [PATCH 2/2] fix dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6eebcc05..640b4777 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,8 @@ FROM kcllang/kcl WORKDIR /app -COPY --from=builder /app/kcl-go . +RUN mkdir /app/bin +COPY --from=builder /app/kcl-go ./bin/ ENV PATH="/app/bin:${PATH}" ENV LANG=en_US.utf8