BlueGit

timfa containerpipes

Files

containerpipes / .gitlab-ci.yml

.gitlab-ci.yml

import 1.7.0
timfa Tim Falken · pushed by timfa · 3 months ago
b32cd771 History
.gitlab-ci.yml 2.8 KiB Download Raw
1# Release pipeline: runs when a version tag is created (e.g. v1.8.0 or 1.8.0).
2#
3# Required CI/CD variable:
4# CI_PUSH_TOKEN — Project Access Token (or PAT) with `write_repository`
5# so the job can push the version-bump commit and move the tag.
6#
7# Flow:
8# 1. validate — reject invalid or non-increasing versions
9# 2. bump — update version in project files, push, retarget tag (ci.skip)
10# 3. build — produce ContainerPipes-<version>.jar and upload to Package Registry
11# 4. release — publish a GitLab Release with the jar attached
12
13workflow:
14 rules:
15 - if: $CI_COMMIT_TAG
16
17variables:
18 GIT_DEPTH: "0"
19 GIT_FETCH_EXTRA_FLAGS: "--tags"
20 GRADLE_OPTS: "-Dorg.gradle.daemon=false"
21
22stages:
23 - validate
24 - bump
25 - build
26 - release
27
28.validate_image:
29 image: alpine:3.20
30 before_script:
31 - apk add --no-cache bash git grep coreutils
32 - git fetch --tags --force origin
33 - chmod +x scripts/release.sh
34
35validate:version:
36 extends: .validate_image
37 stage: validate
38 script:
39 - ./scripts/release.sh validate
40 artifacts:
41 reports:
42 dotenv: version.env
43 paths:
44 - version.env
45
46bump:version:
47 extends: .validate_image
48 stage: bump
49 needs:
50 - job: validate:version
51 artifacts: true
52 script:
53 - ./scripts/release.sh bump
54 artifacts:
55 reports:
56 dotenv: version.env
57 paths:
58 - version.env
59 - build.gradle.kts
60 - src/main/resources/plugin.yml
61 - README.md
62 - src/README-*.md
63 - src/main/java/nl/timfalken/containerpipes/ContainerPipesPlugin.java
64
65build:jar:
66 stage: build
67 image: gradle:8.12-jdk21
68 needs:
69 - job: bump:version
70 artifacts: true
71 before_script:
72 - apt-get update -qq && apt-get install -y -qq curl >/dev/null
73 - chmod +x scripts/release.sh
74 # Checkout may still contain a previous src/README-*.md; keep only the bumped one.
75 - find src -maxdepth 1 -name 'README-*.md' ! -name "README-${VERSION}.md" -delete
76 script:
77 - test -n "${VERSION}"
78 - gradle --no-daemon clean jar
79 - test -f "build/libs/ContainerPipes-${VERSION}.jar"
80 - ls -la "build/libs/ContainerPipes-${VERSION}.jar"
81 - ./scripts/release.sh upload
82 artifacts:
83 reports:
84 dotenv: version.env
85 paths:
86 - "build/libs/ContainerPipes-*.jar"
87 - version.env
88 expire_in: 30 days
89
90release:gitlab:
91 stage: release
92 image: registry.gitlab.com/gitlab-org/release-cli:latest
93 needs:
94 - job: build:jar
95 artifacts: true
96 script:
97 - echo "Publishing GitLab Release for ${TAG} (version ${VERSION})"
98 release:
99 name: "ContainerPipes $VERSION"
100 tag_name: "$TAG"
101 description: "Release $VERSION of ContainerPipes."
102 assets:
103 links:
104 - name: "ContainerPipes-$VERSION.jar"
105 url: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/containerpipes/$VERSION/ContainerPipes-$VERSION.jar"
106 link_type: package