ci: replace sync_submodules step with init/update built-in
This commit is contained in:
parent
1076e43650
commit
f9123097ef
45
.gitea/workflows/dev.yml
Normal file
45
.gitea/workflows/dev.yml
Normal file
@ -0,0 +1,45 @@
|
||||
name: dev
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- dev
|
||||
branches:
|
||||
- 'dev'
|
||||
paths:
|
||||
- '.ci/tag.env'
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.4nkweb.com
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
- name: Init submodules (ensure up-to-date)
|
||||
run: |
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive
|
||||
- name: Build and push images
|
||||
env:
|
||||
REGISTRY: git.4nkweb.com
|
||||
run: |
|
||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||
FROM_COMMIT=$(printf "%s" "$COMMIT_MSG" | sed -n 's/.*ci:[[:space:]]*docker_tag=\([^ ][^\n]*\).*/\1/p' | head -n1)
|
||||
if [ -n "$FROM_COMMIT" ]; then
|
||||
DOCKER_TAG="$FROM_COMMIT"
|
||||
elif [ -f .ci/tag.env ]; then
|
||||
# shellcheck disable=SC1091
|
||||
. .ci/tag.env
|
||||
else
|
||||
DOCKER_TAG="${GITHUB_REF_NAME:-dev-test}"
|
||||
fi
|
||||
bash scripts/build_and_push.sh "$DOCKER_TAG"
|
||||
Loading…
x
Reference in New Issue
Block a user