-
Notifications
You must be signed in to change notification settings - Fork 25
39 lines (32 loc) · 1.04 KB
/
docker.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
name: docker
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Build image
run: |
docker build -f Dockerfile -t denokv .
- name: Smoke test image
run: |
docker run -i --init denokv --help
- name: Login to ghcr.io
if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push images
if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
run: |
docker tag denokv ghcr.io/denoland/denokv:${GITHUB_REF#refs/*/}
docker push ghcr.io/denoland/denokv:${GITHUB_REF#refs/*/}
docker tag denokv ghcr.io/denoland/denokv:latest
docker push ghcr.io/denoland/denokv:latest