-
Notifications
You must be signed in to change notification settings - Fork 10
37 lines (31 loc) · 1.14 KB
/
docker-build.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
28
29
30
31
32
33
34
35
36
37
name: Build and Push Docker Image to GHCR on Release
# Trigger the workflow when a new release is created
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Check out the repository containing the Dockerfile and other necessary files
- name: Checkout repository
uses: actions/checkout@v3
# Set up Docker Buildx for advanced build features like multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Log in to GitHub Container Registry (GHCR)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
# Build and push the Docker image to GHCR with the 'latest' and release tags
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/matthewlarner/inception-mqtt:latest
ghcr.io/matthewlarner/inception-mqtt:${{ github.event.release.tag_name }}