1
0
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-11-17 00:22:32 +01:00
mangadex_at_home/.gitlab-ci.yml

97 lines
2.1 KiB
YAML
Raw Normal View History

stages:
- build
- publish
2021-10-02 05:54:09 +02:00
- docker
- push
2021-10-02 05:54:09 +02:00
Gradle Build:
image: openjdk:8
stage: build
2021-10-02 05:54:09 +02:00
only:
- branches
- tags
- merge_requests
2021-10-01 08:10:07 +02:00
before_script:
2021-10-02 05:54:09 +02:00
- export VERSION="${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
2021-10-01 08:10:07 +02:00
script:
- ./gradlew build
artifacts:
name: "mangadex_at_home"
paths:
- "build/libs/mangadex_at_home-*-all.jar"
2021-10-02 05:54:09 +02:00
Publish Artifacts:
image: alpine
stage: publish
2021-10-02 05:54:09 +02:00
needs:
- Gradle Build
variables:
GIT_STRATEGY: none
2021-10-01 08:10:07 +02:00
before_script:
2021-10-01 08:10:07 +02:00
- apk update && apk add zip
2021-10-02 05:54:09 +02:00
- export VERSION="${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
script:
- cp build/libs/mangadex_at_home-${VERSION}-all.jar ./
- zip -r9 mangadex_at_home-${VERSION}.zip mangadex_at_home-${VERSION}-all.jar settings.sample.yaml
artifacts:
name: "mangadex_at_home"
paths:
- "mangadex_at_home-*-all.jar"
- "mangadex_at_home-*.zip"
- "settings.sample.yaml"
2021-10-02 05:54:09 +02:00
Docker Build:
2021-10-01 08:10:07 +02:00
image: docker:20.10.8
services:
- docker:20.10.8-dind
2021-10-02 05:54:09 +02:00
stage: docker
needs:
- Gradle Build
2021-10-01 08:10:07 +02:00
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin ${CI_REGISTRY}
2021-10-02 05:54:09 +02:00
- export VERSION="${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
2021-10-02 06:13:34 +02:00
- export BASE_TAG="git-$CI_COMMIT_SHORT_SHA"
2021-10-02 05:54:09 +02:00
script:
- mv build/libs/mangadex_at_home-${VERSION}-all.jar build/libs/mangadex_at_home.jar
2021-10-02 05:54:09 +02:00
- docker build . -t $CI_REGISTRY_IMAGE:$BASE_TAG
- docker push $CI_REGISTRY_IMAGE:$BASE_TAG
.docker_push: &docker_push
image: docker:20.10.8
services:
- docker:20.10.8-dind
stage: push
variables:
GIT_STRATEGY: none
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin ${CI_REGISTRY}
2021-10-02 06:13:34 +02:00
- export BASE_TAG="git-$CI_COMMIT_SHORT_SHA"
2021-10-02 05:54:09 +02:00
script:
- docker pull $CI_REGISTRY_IMAGE:$BASE_TAG
- docker tag $CI_REGISTRY_IMAGE:$BASE_TAG $CI_REGISTRY_IMAGE:$NEW_TAG
- docker push $CI_REGISTRY_IMAGE:$NEW_TAG
Push Latest:
<<: *docker_push
needs:
- Docker Build
only:
- master
variables:
NEW_TAG: latest
Push Tags:
<<: *docker_push
needs:
- Docker Build
only:
- tags
variables:
2021-10-19 06:55:53 +02:00
NEW_TAG: $CI_COMMIT_TAG