Skip to content

Commit

Permalink
goreleaser docker publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jimschubert committed May 30, 2021
1 parent e70bde3 commit 5ba39e5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 72 deletions.
51 changes: 29 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Go
on: [push, pull_request]
on: [ push, pull_request ]
jobs:

build:
Expand All @@ -17,6 +17,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Unshallow
if: success() && startsWith(github.ref, 'refs/tags/v')
run: git fetch --prune --unshallow

- name: Cache go module
uses: actions/cache@v2
with:
Expand All @@ -34,24 +38,27 @@ jobs:
name: Docker Build, Tag, Push

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Docker Login Github
if: github.ref == 'refs/heads/master'
run: >-
echo "${{ secrets.GITHUB_TOKEN }}"
| docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
- name: Build
if: github.ref == 'refs/heads/master'
run: docker build -t docker.pkg.github.com/${GITHUB_REPOSITORY}/${GITHUB_REPOSITORY#*/}:latest .

- name: Publish Latest to GitHub Package Registry
if: github.ref == 'refs/heads/master'
run: docker push docker.pkg.github.com/${GITHUB_REPOSITORY}/${GITHUB_REPOSITORY#*/}:latest

- name: Clear
if: always() && github.ref == 'refs/heads/master'
run: |
rm -f ${HOME}/.docker/config.json
- name: Checkout
uses: actions/checkout@v1

- name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/v')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: GoReleaser
uses: goreleaser/[email protected]
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
version: latest
args: release --rm-dist

- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json
50 changes: 0 additions & 50 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 5ba39e5

Please sign in to comment.