diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..563cf7f --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,57 @@ +name: docker + +on: + push: + tags: + - "v*" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: docker_meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - id: docker_build + name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + + - name: Install Cosign + uses: sigstore/cosign-installer@main + + - name: Sign image with a key + run: | + cosign sign --key env://COSIGN_PRIVATE_KEY ${IMAGE_NAME,,}@${IMAGE_DIGEST} --yes + env: + IMAGE_NAME: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + IMAGE_DIGEST: ${{ steps.docker_build.outputs.digest }} + COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}} + COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}} \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..ad329f2 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,27 @@ +name: go + +on: + push: + tags: + - "v*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: "^1.23.0" + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..40bb5ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# syntax = docker/dockerfile:1.2 + +FROM golang:1.23 AS builder + +WORKDIR /src +COPY ./ ./ + +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + CGO_ENABLED=0 GOOS=linux go build -o b64f + + + +FROM alpine:3.20 + +COPY --from=builder /src/b64f /usr/local/bin/b64f +ENTRYPOINT ["/usr/local/bin/b64f"] \ No newline at end of file diff --git a/cosign.pub b/cosign.pub new file mode 100644 index 0000000..7e41bf4 --- /dev/null +++ b/cosign.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJn04ve5VN19lDLLGgtG0EVvgZzzi +3jvdazpZ1UDF/1RZYY4kzwG9XiuiQgCWMt372ysz5Y2AXAAecX7scjp7cA== +-----END PUBLIC KEY-----