Skip to content

Commit c2fe6b2

Browse files
authored
Merge pull request #46 from ks6088ts-labs/feature/issue-44_deploy-ghpkg
add a workflow to deploy container image to GitHub Package
2 parents 2b2d949 + 9c1d759 commit c2fe6b2

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/ghcr.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ghcr
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
env:
7+
IMAGE_NAME: workshop-azure-openai
8+
jobs:
9+
ghcr:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
permissions:
13+
packages: write
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: docker/login-action@v3
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Set Versions
23+
uses: actions/github-script@v7
24+
id: set_version
25+
with:
26+
script: |
27+
const tag = context.ref.substring(10)
28+
const no_v = tag.replace('v', '')
29+
const dash_index = no_v.lastIndexOf('-')
30+
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
31+
core.setOutput('tag', tag)
32+
core.setOutput('no-v', no_v)
33+
core.setOutput('no-dash', no_dash)
34+
- name: Set meta data tag = ${{steps.set_version.outputs.no-dash}}
35+
uses: docker/metadata-action@v5
36+
id: meta
37+
with:
38+
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
39+
tags: |
40+
type=semver,pattern={{version}},value=v${{steps.set_version.outputs.no-dash}}
41+
type=raw,value=latest
42+
- uses: docker/build-push-action@v5
43+
with:
44+
push: true
45+
context: .
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![test](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/test.yaml?query=branch%3Amain)
22
[![docker](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/docker.yaml/badge.svg?branch=main)](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/docker.yaml?query=branch%3Amain)
33
[![docker-release](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/docker-release.yaml/badge.svg)](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/docker-release.yaml)
4+
[![ghcr](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/ghcr.yaml/badge.svg)](https://github.com/ks6088ts-labs/workshop-azure-openai/actions/workflows/ghcr.yaml)
45

56
# workshop-azure-openai
67

0 commit comments

Comments
 (0)