forked from PawanOsman/ChatGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (33 loc) · 988 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
33
34
35
36
37
38
name: Docker Image CI
on:
push:
branches: [ "main" ]
tags: [ "*" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Generate Docker tag
id: docker_tag
run: |
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
TAG_NAME="latest"
else
TAG_NAME=${GITHUB_REF#refs/tags/}
fi
echo "::set-output name=tag::$(echo "docker.pkg.github.com/${{ github.repository }}/openai-api-server:$TAG_NAME" | awk '{print tolower($0)}')"
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.docker_tag.outputs.tag }}