-
Notifications
You must be signed in to change notification settings - Fork 104
44 lines (41 loc) · 1.25 KB
/
ci.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
38
39
40
41
42
43
44
name: Build and Push Docker Image
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: lowercaseRepo
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Check out code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create short sha and tag
shell: bash
run: |
echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then echo TAG=latest; else echo TAG="${GITHUB_REF##*/}"; fi >> $GITHUB_ENV
- name: Build Docker Image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.TAG }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max