-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (67 loc) · 2.63 KB
/
release.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: release
on:
release:
types: [published]
env:
NAME: "azure-openai-gpt-slack-bot"
jobs:
image:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=VERSION::${VERSION}
- name: Get GitHub Tag
id: get_tag
run: |
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Cache container layers
uses: actions/cache@v2.1.4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push container (multi arch)
uses: docker/build-push-action@v2
with:
push: true
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ghcr.io/${{ github.repository_owner }}/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}
build-args: |
VERSION=${{ steps.prep.outputs.VERSION }}
REVISION=${{ github.sha }}
CREATED=${{ steps.prep.outputs.BUILD_DATE }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
- name: Check images
run: |
docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}
docker pull ghcr.io/${{ github.repository_owner }}/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}