Skip to content

Commit ed184b2

Browse files
committed
Integration automatic PR merge from staging to master
1 parent 516ff81 commit ed184b2

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

.gitlab-ci.yml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,33 @@ check:test:
9191
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
9292
when: manual
9393

94+
build:merge:
95+
stage: build
96+
needs: []
97+
# Don't interrupt publishing job
98+
interruptible: false
99+
allow_failure: true
100+
script:
101+
- >
102+
nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
103+
if [ ! gh pr view staging --repo MatrixAI/TypeScript-Demo-Lib-Native >/dev/null 2>/dev/null ]; then
104+
gh pr create \
105+
--head staging \
106+
--base master \
107+
--title 'Merge staging to master' \
108+
--fill \
109+
--assignee '@me' \
110+
--no-maintainer-edit \
111+
--repo MatrixAI/TypeScript-Demo-Lib-Native;
112+
fi;
113+
gh pr merge staging \
114+
--auto \
115+
--repo MatrixAI/TypeScript-Demo-Lib-Native;
116+
'
117+
rules:
118+
# Runs on staging commits
119+
- if: $CI_COMMIT_BRANCH == 'staging'
120+
94121
build:linux:
95122
stage: build
96123
needs:
@@ -271,6 +298,8 @@ integration:deployment:
271298
stage: integration
272299
needs:
273300
- integration:builds
301+
# Don't interrupt deploying job
302+
interruptible: false
274303
script:
275304
- echo 'Perform service deployment for integration testing'
276305
rules:
@@ -422,35 +451,15 @@ integration:prerelease:
422451
# Dependencies must not run on the version commit
423452
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/
424453

425-
integration:merge:
426-
stage: integration
427-
needs:
428-
- job: integration:nix
429-
optional: true
430-
- job: integration:docker
431-
optional: true
432-
- job: integration:linux
433-
optional: true
434-
- job: integration:windows
435-
optional: true
436-
- job: integration:macos
437-
optional: true
438-
script:
439-
- echo 'use gh to create and merge PR from staging to master'
440-
- echo 'use github commit status to signal master to allow merge'
441-
rules:
442-
# Runs on staging commits and ignores version commits
443-
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
444-
# Runs on tag pipeline where the tag is a prerelease or release version
445-
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
446-
447454
release:deployment:
448455
stage: release
449456
needs:
450457
- project: $CI_PROJECT_PATH
451458
job: integration:builds
452459
ref: staging
453460
artifacts: true
461+
# Don't interrupt deploying job
462+
interruptible: false
454463
script:
455464
- echo 'Perform service deployment for production'
456465
rules:

0 commit comments

Comments
 (0)