diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9928de..28ac15a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,6 +37,15 @@ jobs: version: latest install-only: true + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + + - name: Login do docker.io + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Install dependencies run: npm ci diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f95f13e..880a53e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -33,4 +33,48 @@ changelog: disable: true release: - + + +dockers_v2: + - id: commitlint-scope + images: + - 'thumbrise/commitlint-scope' + dockerfile: publish/buildx.Dockerfile + platforms: + - linux/amd64 + - linux/arm64 + tags: + - 'latest' + - '{{ .Tag }}' + - 'v{{ .Major }}.{{ .Minor }}' + labels: + # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys + 'org.opencontainers.image.title': '{{.ProjectName}}' + 'org.opencontainers.image.description': 'Linter that checks if declared commit scopes match the changed files' + 'org.opencontainers.image.source': '{{.GitURL}}' + 'org.opencontainers.image.url': '{{.GitURL}}' + 'org.opencontainers.image.documentation': '{{.GitURL}}' + 'org.opencontainers.image.created': '{{.Date}}' + 'org.opencontainers.image.revision': '{{.FullCommit}}' + 'org.opencontainers.image.version': '{{.Version}}' + - id: commitlint-scope-alpine + images: + - 'thumbrise/commitlint-scope' + dockerfile: publish/buildx-alpine.Dockerfile + platforms: + - linux/amd64 + - linux/arm64 + tags: + - 'latest-alpine' + - '{{ .Tag }}-alpine' + - 'v{{ .Major }}.{{ .Minor }}-alpine' + labels: + # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys + 'org.opencontainers.image.title': '{{.ProjectName}}' + 'org.opencontainers.image.description': 'Linter that checks if declared commit scopes match the changed files' + 'org.opencontainers.image.source': '{{.GitURL}}' + 'org.opencontainers.image.url': '{{.GitURL}}' + 'org.opencontainers.image.documentation': '{{.GitURL}}' + 'org.opencontainers.image.created': '{{.Date}}' + 'org.opencontainers.image.revision': '{{.FullCommit}}' + 'org.opencontainers.image.version': '{{.Version}}' diff --git a/publish/buildx-alpine.Dockerfile b/publish/buildx-alpine.Dockerfile new file mode 100644 index 0000000..2f797ce --- /dev/null +++ b/publish/buildx-alpine.Dockerfile @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1.4 +FROM golang:1.26-alpine + +ARG TARGETPLATFORM + +ENV GOROOT /usr/local/go + +ENV GOTOOLCHAIN auto + +RUN apk --no-cache add gcc musl-dev git mercurial + +RUN git config --global --add safe.directory '*' + +COPY $TARGETPLATFORM/commitlint-scope /usr/bin/ +CMD ["commitlint-scope"] diff --git a/publish/buildx.Dockerfile b/publish/buildx.Dockerfile new file mode 100644 index 0000000..7649401 --- /dev/null +++ b/publish/buildx.Dockerfile @@ -0,0 +1,13 @@ +# syntax=docker/dockerfile:1.4 +FROM golang:1.26 + +ARG TARGETPLATFORM + +ENV GOROOT /usr/local/go + +ENV GOTOOLCHAIN auto + +RUN git config --global --add safe.directory '*' + +COPY $TARGETPLATFORM/commitlint-scope /usr/bin/ +CMD ["commitlint-scope"]