chore: Update GitHub Actions for cross-platform Docker builds on PRs

- Implemented a new GitHub Actions workflow, `pr-check`, for automated Docker image builds on the `master` and `main` branches
- Configured QEMU, Docker Buildx, and Docker Hub authentication within the CI/CD pipeline
- Introduced Docker image builds with cache for improved build performance and reliability
- Established a workflow for pushing built Docker images to Docker Hub
This commit is contained in:
Laisky.Cai
2024-04-27 05:10:58 +00:00
parent e1ce7c1141
commit e607a44d53

35
.github/workflows/pr.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: pr-check
on:
pull_request:
branches:
- "master"
- "main"
jobs:
build_latest:
runs-on: ubuntu-latest
steps:
- name: Checkout
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 Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: try to build
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ppcelery/one-api:pr
cache-from: type=gha
cache-to: type=gha,mode=max