2024-04-16 15:02:03 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
name: 🏗️
|
|
|
|
|
|
|
|
on: # yamllint disable-line rule:truthy
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: ["release/*", "unstable/*"]
|
|
|
|
tags: ["*"]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push:
|
|
|
|
runs-on: ubuntu-latest
|
2024-04-19 10:01:29 +08:00
|
|
|
timeout-minutes: 10
|
2024-04-16 15:02:03 +08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
|
|
run: |
|
|
|
|
IMAGE="ghcr.io/$GITHUB_REPOSITORY:${GITHUB_REF_NAME/'/'/'-'}"
|
|
|
|
echo "IMAGE=$IMAGE" >>"$GITHUB_ENV"
|
|
|
|
docker build . \
|
|
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
|
|
--cache-from $IMAGE \
|
|
|
|
--tag $IMAGE
|
2024-04-27 07:08:30 +08:00
|
|
|
- name: Log in to GHCR
|
2024-04-16 15:02:03 +08:00
|
|
|
if: github.event_name != 'pull_request'
|
2024-05-28 02:00:48 +08:00
|
|
|
run: >-
|
2024-04-16 15:02:03 +08:00
|
|
|
echo ${{ secrets.GITHUB_TOKEN }} |
|
|
|
|
docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
|
2024-04-27 07:08:30 +08:00
|
|
|
- name: Push Docker image to GHCR
|
|
|
|
if: github.event_name != 'pull_request'
|
2024-05-28 02:00:48 +08:00
|
|
|
run: docker push $IMAGE
|