chore(deps): update all (major) #624
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branch: ['master', 'main'] | |
tags: ['v*'] | |
pull_request: | |
release: | |
types: [published,released] | |
jobs: | |
repoman: | |
runs-on: ubuntu-latest | |
outputs: | |
has-docker: ${{ steps.info.outputs.has-docker }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- uses: moul/repoman-action@v1 | |
id: info | |
multi: | |
needs: repoman | |
if: needs.repoman.outputs.has-docker == 'true' | |
name: "build-and-push" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build the container image | |
uses: docker/[email protected] | |
with: | |
repository: golang-repo-template | |
- name: Push to GitHub Packages | |
uses: docker/[email protected] | |
if: github.event_name == 'release' || github.event_name == 'push' | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: docker.pkg.github.com | |
repository: moul/golang-repo-template/golang-repo-template | |
tag_with_ref: true | |
- name: Check Docker Hub Credentials | |
id: check_dockerhub_credentials | |
if: github.event_name == 'release' || github.event_name == 'push' | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
if [ "${DOCKER_USERNAME}" == "" ]; then | |
echo "Missing Username" | |
echo "##[set-output name=missingsecrets;]$(echo yes)" | |
elif [ "${DOCKER_PASSWORD}" == "" ]; then | |
echo "Missing Password" | |
echo "##[set-output name=missingsecrets;]$(echo yes)" | |
else | |
echo "All secrets present" | |
echo "##[set-output name=missingsecrets;]$(echo no)" | |
fi | |
- name: Push to Docker Hub | |
if: | | |
(github.event_name == 'release' || github.event_name == 'push') && | |
contains(steps.check_dockerhub_credentials.outputs.missingsecrets, 'no') | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: moul/golang-repo-template | |
tag_with_ref: true |