add: auto-mirror-to-repo-pwk
This commit is contained in:
parent
51a2aa196d
commit
daec36536b
@ -1,4 +1,5 @@
|
|||||||
stages:
|
stages:
|
||||||
|
- mirror
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
@ -7,6 +8,37 @@ variables:
|
|||||||
IMAGE_TAG: v1.0.0
|
IMAGE_TAG: v1.0.0
|
||||||
CONTAINER_NAME: purwakarta-diskominfo-simedkom-new
|
CONTAINER_NAME: purwakarta-diskominfo-simedkom-new
|
||||||
|
|
||||||
|
mirror:
|
||||||
|
stage: mirror
|
||||||
|
image: alpine:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GIT_DEPTH: 0
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- apk add --no-cache git
|
||||||
|
|
||||||
|
script:
|
||||||
|
- git config --global user.email "mirror@pratama.live"
|
||||||
|
- git config --global user.name "Pratama CI Mirror"
|
||||||
|
|
||||||
|
- git checkout $CI_COMMIT_REF_NAME
|
||||||
|
|
||||||
|
- rm -f .gitlab-ci.yml Dockerfile docker-compose.yml
|
||||||
|
- rm -rf .gitlab
|
||||||
|
|
||||||
|
- git add -A
|
||||||
|
- TREE=$(git write-tree)
|
||||||
|
- ORIGINAL_COMMIT=$(git rev-parse --short HEAD)
|
||||||
|
- COMMIT=$(echo "Automated mirror from main@$ORIGINAL_COMMIT" | git commit-tree $TREE -p HEAD)
|
||||||
|
|
||||||
|
- git remote remove pwk || true
|
||||||
|
- git remote add pwk https://$MIRROR_PWK_USERNAME:$MIRROR_PWK_TOKEN@$MIRROR_PWK_URL
|
||||||
|
|
||||||
|
- git push pwk $COMMIT:dev --force
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
timeout: 60m
|
timeout: 60m
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user