mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-03 21:03:04 +08:00
70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
name: Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- 'README.md'
|
|
- 'docker-compose.yml'
|
|
- 'docker-compose-warp.yml'
|
|
- 'docs/**'
|
|
- '.github/workflows/build_docker_main.yml'
|
|
- '.github/workflows/build_docker_dev.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
main:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out the repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Read the version from version.txt
|
|
id: get_version
|
|
run: |
|
|
version=$(cat version.txt)
|
|
echo "Current version: v$version"
|
|
echo "::set-output name=version::v$version"
|
|
|
|
- name: Commit and push version tag
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
version=${{ steps.get_version.outputs.version }}
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git tag "$version"
|
|
git push https://x-access-token:${GHCR_PAT}@github.com/lanqian528/chat2api.git "$version"
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: lanqian528/chat2api
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=raw,value=${{ steps.get_version.outputs.version }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
file: Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |