-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(ai-service): automatically create docker image when pr merged (…
…#59) * support the workflow to build nightly image * remove the testing branch * remove the deprecated workflow * release nightly image workflow * remove the testing branch * rename the workflows * manual release image workflow * remove the testing branch * release stable image * remove the testing code --------- Co-authored-by: Chih-Yu Yeh <[email protected]>
- Loading branch information
Showing
3 changed files
with
119 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: AI Service Release nightly image | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'wren-ai-service/**' | ||
|
||
defaults: | ||
run: | ||
working-directory: wren-ai-service | ||
|
||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Prepare tag name | ||
id: tag-preparation | ||
run: | | ||
tag_name=main-$(git log -1 --pretty=%h) | ||
echo "TAG_NAME=$tag_name" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push image | ||
env: | ||
TAG_NAME: ${{ steps.tag-preparation.outputs.TAG_NAME }} | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag ghcr.io/canner/wren-ai-service:$TAG_NAME \ | ||
--tag ghcr.io/canner/wren-ai-service:nightly \ | ||
--file ./docker/Dockerfile \ | ||
--push . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: AI Service Release stable image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Give a version for this release | ||
type: string | ||
required: true | ||
|
||
defaults: | ||
run: | ||
working-directory: wren-ai-service | ||
|
||
jobs: | ||
upgrade-ai-service-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "stable-release-bot" | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
- name: Install Poetry | ||
uses: abatilo/actions-poetry@v2 | ||
with: | ||
poetry-version: 1.7.1 | ||
- name: Upgrade AI Service version | ||
run: | | ||
version=${{ github.event.inputs.version }} | ||
poetry version --next-phase $version | ||
git add pyproject.toml | ||
git commit -m "Upgrade AI Service version to $version" | ||
git push | ||
build-image: | ||
needs: upgrade-ai-service-version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push image | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag ghcr.io/canner/wren-ai-service:${{ github.event.inputs.version }} \ | ||
--tag ghcr.io/canner/wren-ai-service:latest \ | ||
--file ./docker/Dockerfile \ | ||
--push . |