Merge pull request #11 from kariudo/kariudo/issue6 #31
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: Build and Publish Docker Image | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
dockerbuildpush: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set a datetag variable | |
run: echo "DATETAG=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV | |
- name: Create image from repository | |
run: docker build -t ghcr.io/${{ github.actor }}/homeassistant-discord-bot:latest -t ghcr.io/${{ github.actor }}/homeassistant-discord-bot:${{ env.DATETAG }} . | |
- name: Push image to GitHub Container Registry with date tag | |
run: docker push ghcr.io/${{ github.actor }}/homeassistant-discord-bot:${{ env.DATETAG }} | |
- name: Push image to GitHub Container Registry as latest | |
run: docker push ghcr.io/${{ github.actor }}/homeassistant-discord-bot:latest |