change empty var check for publicIP #31
Workflow file for this run
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: container-images | |
on: | |
push: | |
branches: [ "main" ] | |
tags: [ "v*" ] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
- run: echo "IMAGE_TAG=dev" >> $GITHUB_ENV | |
if: github.ref_name == 'main' | |
- run: echo "IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
if: startsWith(github.ref, 'refs/tags/v') | |
- name: Login to ghcr.io | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to docker.io | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_UID }} | |
password: ${{ secrets.DOCKER_HUB_PAT }} | |
- name: Build and push default image | |
uses: docker/[email protected] | |
with: | |
context: . # Because GH actions are for kids and put protection on everything; https://stackoverflow.com/a/71159809/11276254 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }} | |
${{ secrets.DOCKER_HUB_REPO }}:${{ env.IMAGE_TAG }} |