Skip to content

Commit daea377

Browse files
authored
✨ add gitops template (only for staffbase members) (#23)
* ✨ add gitops template * 🎨 adapt default values * 📝 add doc for gitops template * 🎨 make image name optional * 🎨 add build args * ⏪ revert some minor changes
1 parent cc542a2 commit daea377

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: GitOps
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
gitopsdev:
7+
required: false
8+
type: string
9+
gitopsstage:
10+
required: false
11+
type: string
12+
gitopsprod:
13+
required: false
14+
type: string
15+
image:
16+
required: false
17+
type: string
18+
default: private/${{ github.event.repository.name }}
19+
secrets:
20+
docker_username:
21+
required: true
22+
docker_password:
23+
required: true
24+
gitops_token:
25+
required: true
26+
27+
jobs:
28+
gitops:
29+
30+
name: Deploy
31+
runs-on: ubuntu-20.04
32+
33+
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
39+
- uses: actions/checkout@v3
40+
with:
41+
repository: Staffbase/gitops-github-action
42+
ref: v3
43+
token: ${{ secrets.gitops_token }}
44+
path: .github/gitops
45+
46+
- name: GitOps (build, push and deploy a new Docker image)
47+
uses: ./.github/gitops
48+
with:
49+
dockerusername: ${{ secrets.docker_username }}
50+
dockerpassword: ${{ secrets.docker_password }}
51+
dockerimage: ${{ inputs.image }}
52+
gitopstoken: ${{ secrets.gitops_token }}
53+
gitopsdev: ${{ inputs.gitopsdev }}
54+
gitopsstage: ${{ inputs.gitopsstage }}
55+
gitopsprod: ${{ inputs.gitopsprod }}

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,25 @@ jobs:
7373
```
7474
</details>
7575
76+
### GitOps
77+
78+
<details>
79+
<summary>The action can be used to build and publish a docker image.</summary>
80+
81+
```yml
82+
name: GitOps
83+
on: [push]
84+
85+
jobs:
86+
gitops:
87+
uses: Staffbase/gha-workflows/.github/workflows/template_gitops.yml@<version>
88+
secrets:
89+
gitops_token: ${{ <your-gitops-token> }}
90+
docker_username: ${{ <your-docker-username> }}
91+
docker_password: ${{ <your-docker-password> }}
92+
```
93+
</details>
94+
7695
### Release Drafter
7796
7897
<details>

0 commit comments

Comments
 (0)