-
-
Notifications
You must be signed in to change notification settings - Fork 0
27 lines (25 loc) · 1.03 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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