Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit ac9723b

Browse files
author
a.ryoo
committed
Initial Commit
0 parents  commit ac9723b

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
*.iml
3+
.DS_Store

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Gitlab Trigger Action
2+
3+
### Inputs
4+
endpoint - (Optional) Endpoint to Gitlab. e.g. https://gitlab.example.com. Leave blanc for default <br>
5+
token - Your Gitlab token. Make sure token has rights to launch pipelines <br>
6+
projectId - ProjectId of your pipeline repo <br>
7+
envs - (Optional) Environment variables you want to pass to Gitlab <br>
8+
ref - (Optional) Git branch of target pipeline repo
9+
10+
## Example
11+
```yaml
12+
name: Build
13+
14+
on:
15+
push:
16+
branches:
17+
- '*'
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: qameta/gitlab-trigger@master
24+
with:
25+
token: ${{ secrets.GITLAB_TOKEN }}
26+
projectId: "154854"
27+
envs: VERSION=${{ steps.version.outputs.name }},ARCH=amd64
28+
```

action.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Gitlab Trigger Action"
2+
description: "Triggers Gitlab pipeline with envs"
3+
inputs:
4+
token:
5+
description: "Gitlab token"
6+
required: true
7+
projectId:
8+
description: "Project ID where your Gitlab CI Pipeline awaits"
9+
required: true
10+
endpoint:
11+
description: "Gitlab endpoint (defaults to Official Gitlab Endpoint)"
12+
default: "https://gitlab.com"
13+
required: false
14+
ref:
15+
description: "Git branch of target pipeline"
16+
default: "master"
17+
required: false
18+
envs:
19+
description: "Environment variables separated with , without spaces (e.g. VERSION=1.1.2,ARCH=amd64)"
20+
required: false
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Download gl cli util
25+
shell: bash
26+
run: |
27+
echo "Downloading and installing dependencies"
28+
curl https://dl.qameta.io/artifactory/bin/gitlab/gl -o gl && \
29+
chmod +x gl && \
30+
mv gl /usr/local/bin
31+
- name: Authorizing in Gitlab
32+
shell: bash
33+
run: gl auth login --token=${{ inputs.token }} --project-id=${{ inputs.projectId }} --endpoint=${{ inputs.endpoint }}
34+
- name: Triggering Gitlab Pipeline
35+
shell: bash
36+
run: gl pipeline run --ref=${{ inputs.ref }} --env=${{ inputs.envs }}

0 commit comments

Comments
 (0)