mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
Update build-push.yml
This commit is contained in:
parent
403d9a521c
commit
ca1fcffa4b
1 changed files with 25 additions and 20 deletions
45
.github/workflows/build-push.yml
vendored
45
.github/workflows/build-push.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Docker Build and Publish Package
|
name: Docker Build and Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -8,35 +8,45 @@ on:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
package:
|
version:
|
||||||
description: 'Name of the package to publish (e.g. my-docker-package)'
|
description: 'Version to build and publish (e.g. v0.2.0)'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare-publish:
|
prepare-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
package: ${{ steps.get-package.outputs.package }}
|
version: ${{ steps.get-version.outputs.version }}
|
||||||
|
is_prerelease: ${{ steps.check-prerelease.outputs.is_prerelease }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get package name
|
- name: Get version
|
||||||
id: get-package
|
id: get-version
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
echo "package=${{ inputs.package }}" >> $GITHUB_OUTPUT
|
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
# For non-dispatch events, read the package name from a file called PACKAGE.
|
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
|
||||||
echo "package=$(cat PACKAGE)" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Check if prerelease
|
||||||
|
id: check-prerelease
|
||||||
|
run: |
|
||||||
|
echo "is_prerelease=${{ contains(steps.get-version.outputs.version, '-pre') }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build-images:
|
build-images:
|
||||||
needs: prepare-publish
|
needs: prepare-release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
BUILDKIT_STEP_LOG_MAX_SIZE: 10485760
|
||||||
|
# The version from the prepare-release job will override the VERSION variable
|
||||||
|
VERSION: ${{ needs.prepare-release.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -71,12 +81,7 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push images
|
||||||
env:
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
BUILDKIT_STEP_LOG_MAX_SIZE: 10485760
|
|
||||||
PACKAGE: ${{ needs.prepare-publish.outputs.package }}
|
|
||||||
run: |
|
run: |
|
||||||
# This command assumes you have a docker-bake configuration that
|
# Override the VERSION variable in your bake file with the provided version.
|
||||||
# uses the image tag information. Here we override the tag to use the package name.
|
docker buildx bake --push --set VERSION=$VERSION
|
||||||
docker buildx bake --push --set "*.tags=ghcr.io/${{ github.repository_owner }}/${PACKAGE}:latest"
|
|
Loading…
Add table
Reference in a new issue