diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 150d7d1..6002049 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -87,31 +87,34 @@ jobs: docker: runs-on: ubuntu-latest environment: docker - needs: - - info steps: - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: 1915keke/commitlint-rs + tags: | + type=raw,value=latest + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + - uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 push: true - tags: 1915keke/commitlint-rs:${{ needs.info.outputs.tag }} + tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max - info: - runs-on: ubuntu-latest - outputs: - tag: ${{ steps.info.outputs.tag }} - steps: - - id: info - run: echo tag=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/v//') >> $GITHUB_OUTPUT - publish: runs-on: ubuntu-latest needs: diff --git a/Dockerfile b/Dockerfile index 0682ba8..514f59d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,18 @@ FROM rust:1.80-alpine as builder WORKDIR /app -RUN apk update \ +RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \ + apk update \ && apk add --no-cache musl-dev -RUN --mount=type=bind,target=. cargo install --path . +COPY . . +RUN cargo install --path . FROM alpine LABEL maintainer="KeisukeYamashita <19yamashita15@gmail.com>" -RUN apk update \ +RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \ + apk update \ && apk add --no-cache musl-dev COPY --from=builder /usr/local/cargo/bin/commitlint /usr/local/bin/commitlint