v3.6.2 #242
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 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 |