AI Service Release stable image #40
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
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: | |
- name: Generate a token | |
id: generate-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.CI_APP_ID }} | |
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Set up Git | |
run: | | |
git config --global user.name "wren-ai[bot]" | |
git config --global user.email "[email protected]" | |
- name: Set up Python 3.12.0 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12.0 | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.8.3 | |
- 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 . |