-
Notifications
You must be signed in to change notification settings - Fork 47
41 lines (35 loc) · 1.31 KB
/
trigger-gitlab-pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Trigger GitLab Deploy Pipeline
on:
workflow_dispatch:
workflow_run:
workflows: ["Check codebase"]
branches:
- develop
- master
- 'refs/tags/[0-9]+.[0-9]+.[0-9]+*'
types:
- completed
jobs:
trigger-gitlab:
name: Trigger GitLab CI
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Config Gitlab env
run: |
git config --global user.name "github-actions[bot]"
git remote add gitlab https://oauth2:${{ secrets.KILTBOT_PUSH_ACCESS_TOKEN }}@gitlab.com/kiltprotocol/kilt-node
- name: Push latest ref (branch or tag)
run: git push gitlab ${{ github.ref_name }}
# It can happen that the Gitlab mirror is updated in the meanwhile, and the ref already exists there, so we ignore the error.
continue-on-error: true
- name: Trigger GitLab CI
run: |
curl -X POST \
-F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} \
-F ref=${{ github.ref_name }} \
https://gitlab.com/api/v4/projects/${{ vars.GITLAB_PROJECT_ID }}/trigger/pipeline