Skip to content

合并拉取请求 #72 #38

合并拉取请求 #72

合并拉取请求 #72 #38

name: Build Docker Image
on:
push:
tags:
- 'release-v*'
workflow_dispatch:
env:
GHCR_REPO: ghcr.io/aurorax-neo/free-gpt3.5-2api
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Docker Image Tag
shell: bash
id: get_docker_image_tag
run: echo "tag=$(echo $GITHUB_REF | sed 's|refs/tags/release-v||')" >> $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.repository_owner }}
password: ${{ secrets.GB_TOKEN }}
- name: Cache Docker Layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: "${{ runner.os }}-buildx-${{ github.sha }}"
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker Image And Push To GHCR
uses: docker/build-push-action@v5
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ steps.get_docker_image_tag.outputs.tag }}
${{ env.GHCR_REPO }}:${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 8