SLD Dashboard Docker Image CI #219
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: SLD Dashboard Docker Image CI | |
on: | |
push: | |
branches: [ master ] | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
# Login to Docker Hub | |
- name: Docker login | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
# Build and push the Docker image with new tag for releases | |
- name: Build and push Docker image with new tag | |
if: github.event_name == 'release' | |
working-directory: ./sld-dashboard | |
run: | | |
TAG=$(echo $GITHUB_REF | sed 's/refs\/tags\///') | |
docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:$TAG | |
docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:$TAG | |
# Build and push the Docker image with 'latest' tag for master branch | |
- name: Build and push Docker image with latest tag | |
if: github.ref == 'refs/heads/master' | |
working-directory: ./sld-dashboard | |
run: | | |
docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:latest | |
docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:latest |