From 2307bff72f64d8712322e1c07a83207b371b8c46 Mon Sep 17 00:00:00 2001 From: Anthony MARQUES Date: Thu, 1 Apr 2021 17:41:35 +0200 Subject: [PATCH] feat: add docker image on release and master (#135) * feat: add docker image on release and master * resolves return on the PR * Add Installation docker doc * Update .github/workflows/publish.yml Co-authored-by: Derek Smith * Resovle PR conversations * No v in RawVersion Co-authored-by: Derek Smith --- .github/workflows/publish.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 9 ++++++++- .goreleaser.yml | 5 +++++ Dockerfile | 11 +++++++++++ README.md | 10 ++++++++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml create mode 100644 Dockerfile diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..e0a641e8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: publish + +on: + push: + branches: + - master + +env: + GO_VERSION: "1.16" + DOCKER_REGISTRY: "quay.io" + +jobs: + goreleaser: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - name: Build go binary + run: make build + - name: Login to GitHub Packages Docker Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ secrets.QUAY_IO_USER }} + password: ${{ secrets.QUAY_IO_TOKEN }} + - name: Build and Push docker image + run: | + docker build --pull --tag ${{ env.DOCKER_REGISTRY }}/git-chglog/git-chglog:edge . + docker push ${{ env.DOCKER_REGISTRY }}/git-chglog/git-chglog:edge diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dab5ed9c..1821bfdc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: env: GO_VERSION: "1.16" + DOCKER_REGISTRY: "quay.io" jobs: goreleaser: @@ -22,7 +23,13 @@ jobs: uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} - + - name: Login to GitHub Packages Docker Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ secrets.QUAY_IO_USER }} + password: ${{ secrets.QUAY_IO_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index 834eee6b..b0d7d922 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -38,6 +38,11 @@ changelog: snapshot: name_template: "{{ .Tag }}-next" +dockers: + - image_templates: + - "quay.io/git-chglog/git-chglog:{{ .RawVersion }}" + - "quay.io/git-chglog/git-chglog:latest" + brews: - tap: owner: git-chglog diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e0c24eb3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:3.13.3 + +RUN apk add --no-cache git && \ + mkdir /workdir + +COPY git-chglog /usr/local/bin/git-chglog + +WORKDIR /workdir +RUN chmod +x /usr/local/bin/git-chglog + +ENTRYPOINT [ "/usr/local/bin/git-chglog" ] \ No newline at end of file diff --git a/README.md b/README.md index e4e56e31..6e5146cd 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,16 @@ asdf install git-chglog latest go get -u github.com/git-chglog/git-chglog/cmd/git-chglog ``` +### [Docker](https://www.docker.com/) +The compiled docker images are maintained on [quay.io](https://quay.io/repository/git-chglog/git-chglog). +We maintain the following tags: +- `edge`: Image that is build from the current `HEAD` of the main line branch. +- `latest`: Image that is built from the [latest released version](https://github.com/git-chglog/git-chglog/releases) +- `x.y.y` (versions): Images that are build from the tagged versions within Github. +```bash +docker pull quay.io/git-chglog/git-chglog:latest +docker run -v "$PWD":/workdir quay.io/git-chglog/git-chglog --version +``` --- If you are using another platform, you can download a binary from the [releases page]