From 9589b4f2efcc6a3eebd3518df44f9f42925deb8c Mon Sep 17 00:00:00 2001 From: "Reichenbach, Michael" Date: Fri, 24 Jun 2022 11:51:14 +0200 Subject: [PATCH] feat(release): publish docker image to docker hub --- .github/workflows/go.yml | 12 +++++++++++- .goreleaser.yaml | 12 ++++++++++++ Dockerfile | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 93c357a..b20fc39 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -38,9 +38,19 @@ jobs: with: go-version: 1.16 - run: go build + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - uses: go-semantic-release/action@v1 with: hooks: goreleaser prerelease: false env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index dd57a62..f34f7b6 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -21,6 +21,18 @@ archives: 386: i386 amd64: x86_64 format: binary +dockers: + - image_templates: + - "StephanHCB/go-generator-cli:{{ .Tag }}" + - "StephanHCB/go-generator-cli:v{{ .Major }}" + - "StephanHCB/go-generator-cli:v{{ .Major }}.{{ .Minor }}" + - "StephanHCB/go-generator-cli:latest" + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" checksum: name_template: 'checksums.txt' snapshot: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0e4479c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch +COPY go-generator-cli / +ENTRYPOINT ["/go-generator-cli"] \ No newline at end of file