diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml deleted file mode 100644 index 3b06537..0000000 --- a/.github/workflows/build-docker.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: build-docker - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v2 - with: - go-version: 1.15.x - - uses: actions/checkout@v2 - - name: Login to quay.io Docker Image Registry - uses: docker/login-action@v1 - with: - registry: quay.io - username: "${{ secrets.QUAY_USER }}" - password: "${{ secrets.QUAY_PASS }}" - - run: make docker docker-publish - env: - DOCKER_IMAGE_TAG: ${{ github.event.release.tag_name }} - - run: make docker docker-publish - env: - DOCKER_IMAGE_TAG: latest diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..4b069e3 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,28 @@ +name: Docker + +on: + push: + branches: + - master + tags: + - '*' + +jobs: + push: + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image & push + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + [ "$VERSION" == "master" ] && VERSION=latest + docker build -t ghcr.io/${{ github.repository }}:$VERSION . + docker push ghcr.io/${{ github.repository }}:$VERSION + if [ "$VERSION" != "latest" ] ; then + docker tag ghcr.io/${{ github.repository }}:$VERSION ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:latest + fi \ No newline at end of file