Skip to content

Commit

Permalink
Integration automatic PR merge from staging to master
Browse files Browse the repository at this point in the history
  • Loading branch information
CMCDragonkai committed May 23, 2022
1 parent 516ff81 commit ed184b2
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,33 @@ check:test:
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual

build:merge:
stage: build
needs: []
# Don't interrupt publishing job
interruptible: false
allow_failure: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
if [ ! gh pr view staging --repo MatrixAI/TypeScript-Demo-Lib-Native >/dev/null 2>/dev/null ]; then
gh pr create \
--head staging \
--base master \
--title 'Merge staging to master' \
--fill \
--assignee '@me' \
--no-maintainer-edit \
--repo MatrixAI/TypeScript-Demo-Lib-Native;
fi;
gh pr merge staging \
--auto \
--repo MatrixAI/TypeScript-Demo-Lib-Native;
'
rules:
# Runs on staging commits
- if: $CI_COMMIT_BRANCH == 'staging'

build:linux:
stage: build
needs:
Expand Down Expand Up @@ -271,6 +298,8 @@ integration:deployment:
stage: integration
needs:
- integration:builds
# Don't interrupt deploying job
interruptible: false
script:
- echo 'Perform service deployment for integration testing'
rules:
Expand Down Expand Up @@ -422,35 +451,15 @@ integration:prerelease:
# Dependencies must not run on the version commit
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/

integration:merge:
stage: integration
needs:
- job: integration:nix
optional: true
- job: integration:docker
optional: true
- job: integration:linux
optional: true
- job: integration:windows
optional: true
- job: integration:macos
optional: true
script:
- echo 'use gh to create and merge PR from staging to master'
- echo 'use github commit status to signal master to allow merge'
rules:
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on tag pipeline where the tag is a prerelease or release version
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

release:deployment:
stage: release
needs:
- project: $CI_PROJECT_PATH
job: integration:builds
ref: staging
artifacts: true
# Don't interrupt deploying job
interruptible: false
script:
- echo 'Perform service deployment for production'
rules:
Expand Down

0 comments on commit ed184b2

Please sign in to comment.