-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76ad629
commit a05485a
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: 📦️ build api-server | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/api-server.yaml' | ||
- 'src/api-server/**' | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/api-server.yaml' | ||
- 'src/api-server/**' | ||
tags: | ||
- 'api-server_v[0-9]+.[0-9]+.[0-9]+' | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
REGISTRY: ghcr.io | ||
jobs: | ||
docker-build: | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
packages: write | ||
runs-on: buildjet-2vcpu-ubuntu-2204 | ||
name: "${{ github.event_name == 'pull_request' && 'build ' || 'release' }} image" | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: docker login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: set up buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ github.repository_owner }}/api-server | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=match,pattern=api-server_(v\d+.\d+.\d+),group=1 | ||
type=raw,value={{branch}}-{{sha}}-{{date 'X'}},enable={{is_default_branch}} | ||
type=ref,event=pr | ||
- name: build docker images | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: "{{defaultContext}}:src/api-server" | ||
file: Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |