-
-
Notifications
You must be signed in to change notification settings - Fork 53
32 lines (27 loc) · 950 Bytes
/
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
28
29
30
31
32
name: Docker Image CI
on:
workflow_dispatch:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: PrepareReg Names
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
echo IMAGE_TAG=$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{split($0,a,"/"); print a[3]}') >> $GITHUB_ENV
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
run: |
docker build . --tag ghcr.io/$IMAGE_REPOSITORY:$IMAGE_TAG
docker push ghcr.io/$IMAGE_REPOSITORY:$IMAGE_TAG
docker build . --tag ghcr.io/$IMAGE_REPOSITORY:latest
docker push ghcr.io/$IMAGE_REPOSITORY:latest