Skip to content

Merge pull request #231 from D10S0VSkY-OSS/refactor/sld-home #235

Merge pull request #231 from D10S0VSkY-OSS/refactor/sld-home

Merge pull request #231 from D10S0VSkY-OSS/refactor/sld-home #235

name: SLD Remote State 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-remote-state
run: |
TAG=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-remote-state:$TAG
docker push ${{ secrets.DOCKER_USERNAME }}/sld-remote-state:$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-remote-state
run: |
docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-remote-state:latest
docker push ${{ secrets.DOCKER_USERNAME }}/sld-remote-state:latest