-
Notifications
You must be signed in to change notification settings - Fork 7
51 lines (51 loc) · 1.62 KB
/
docker.yaml
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
45
46
47
48
49
50
51
name: docker
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set build tag env vars
run: |
echo "NSC_VERSION=$(cat ./VERSION)" >> $GITHUB_ENV
echo "NSC_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- id: dockermetadata
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/peterldowns/nix-search-cli
tags: |
# short sha of the commit
type=sha,prefix=,suffix=,format=short
# long sha of the commit
type=sha,prefix=,suffix=,format=long
# "latest"
type=raw,value=${{ env.NSC_VERSION }}
type=raw,value=${{ env.NSC_VERSION }}-commit.${{ env.NSC_COMMIT_SHA }}
type=raw,value=latest
- uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.dockermetadata.outputs.tags }}
labels: ${{ steps.dockermetadata.outputs.labels }}
build-args: |
VERSION=${{ env.NSC_VERSION }}
COMMIT_SHA=${{ env.NSC_COMMIT_SHA }}