-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (92 loc) · 2.73 KB
/
cicd.yaml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
name: "CI/CD"
"on":
push:
pull_request:
jobs:
pre-commit-job:
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository"
uses: "actions/[email protected]"
- name: "Setup python"
uses: "actions/[email protected]"
- name: "Run pre-commit"
uses: "pre-commit/[email protected]"
go-test-job:
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository"
uses: "actions/[email protected]"
- name: "Setup go"
uses: "actions/[email protected]"
with:
go-version: "1.22.3"
- name: "Run go test"
run: "go test ./..."
go-build-job:
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository"
uses: "actions/[email protected]"
- name: "Setup go"
uses: "actions/[email protected]"
with:
go-version: "1.22.3"
- name: "Run go build"
run: "go build"
release-job:
runs-on: "ubuntu-22.04"
needs:
- "go-test-job"
- "go-build-job"
- "pre-commit-job"
permissions:
contents: "write"
steps:
- name: "Check out repository"
uses: "actions/[email protected]"
with:
fetch-depth: 0
- name: "Setup go"
uses: "actions/[email protected]"
with:
go-version: "1.22.3"
- name: "Setup node"
uses: "actions/[email protected]"
with:
node-version: "22.2.0"
- name: "Setup goreleaser"
run: "go install github.com/goreleaser/goreleaser/[email protected]"
- name: "Login to Docker Hub"
uses: "docker/[email protected]"
with:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_LABDOC_GORELEASER_TOKEN }}"
- name: "Run semantic-release"
uses: "cycjimmy/[email protected]"
with:
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_LABDOC_GORELEASER_TOKEN: "${{ secrets.DOCKER_LABDOC_GORELEASER_TOKEN }}"
HOMEBREW_TAP_ERNAIL_GITHUB_TOKEN: "${{ secrets.HOMEBREW_TAP_ERNAIL_GITHUB_TOKEN }}"
mirror-gitlab-job:
runs-on: "ubuntu-22.04"
needs:
- "release-job"
steps:
- name: "Check out repository"
uses: "actions/[email protected]"
with:
fetch-depth: 0
- name: "Add Gitlab Remote"
run: |
git remote add gitlab https://oauth2:${{ secrets.GITLAB_LABDOC_MIRROR_TOKEN }}@gitlab.com/erNail/labdoc.git
- name: "Push all branches to GitLab"
run: "git push gitlab --all --force"
- name: "Push all tags to GitLab"
run: "git push gitlab --tags --force"
...