-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (29 loc) · 1.01 KB
/
master.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
name: build and push
on:
push:
branches: main
env:
configmap_image: ghcr.io/${{ github.repository }}/configmap-reload
jobs:
build-and-push:
name: Build and push to ghcr.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set version
run: |
echo "CONFIGMAP_IMAGE=${configmap_image}:$(date '+%Y-%m-%d')-$(git --no-pager log -1 --pretty=%h)" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@ab80d026d4753220c4243394c07c7d80f9638d06 # Use commit-sha1 instead of tag for security concerns
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.CONFIGMAP_IMAGE }}, ${{ env.configmap_image }}:latest