Skip to content

Commit 07128c1

Browse files
authored
Merge pull request #1 from ctfpilot/develop
Release v1.1.0
2 parents a02251a + 533e71e commit 07128c1

5 files changed

Lines changed: 196 additions & 13 deletions

File tree

.github/workflows/cla-assistant.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_call:
44
inputs:
55
repository:
6-
description: "The repository that the CLA is generated for"
6+
description: "The repository that the CLA is generated for. Example `hello-world`."
77
required: true
88
type: string
99
version:
@@ -43,7 +43,7 @@ jobs:
4343

4444
# branch should not be protected
4545
branch: "main"
46-
allowlist: ""
46+
allowlist: "semantic-release-bot"
4747
lock-pullrequest-aftermerge: false
4848
use-dco-flag: false
4949

.github/workflows/cla-internal.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -----------
2+
# NOTICE: This workflow is for internal use within the CI repository
3+
# -----------
4+
5+
name: "CLA Assistant"
6+
7+
on:
8+
issue_comment:
9+
types: [created]
10+
pull_request_target:
11+
types: [opened, closed, synchronize]
12+
13+
jobs:
14+
CLAAssistant:
15+
permissions:
16+
actions: write
17+
contents: read
18+
pull-requests: write
19+
statuses: write
20+
name: "CLA Assistant"
21+
uses: ctfpilot/ci/.github/workflows/cla-assistant.yml@v1.0.0
22+
secrets: inherit
23+
with:
24+
repository: ci

.github/workflows/docker.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Docker build and push
2+
on:
3+
workflow_call:
4+
inputs:
5+
repository:
6+
description: "Allowed repository for workflow to run in. Example `ctfpilot/hello-world`."
7+
required: true
8+
type: string
9+
dockerfile:
10+
description: "Dockerfile path."
11+
required: false
12+
default: "./Dockerfile"
13+
type: string
14+
context:
15+
description: "Build context."
16+
required: false
17+
default: "."
18+
type: string
19+
arguments:
20+
description: "Build arguments. List of key-value pairs."
21+
required: false
22+
default: ""
23+
type: string
24+
semver:
25+
description: "Semantic version. Leave empty to not use semantic versioning."
26+
required: false
27+
default: ""
28+
type: string
29+
tags:
30+
description: "List of tags to apply to the image. Required if you do not use semantic versioning."
31+
required: false
32+
default: |
33+
type=raw,value=${{ github.sha }}
34+
type: string
35+
registry:
36+
description: "Registry for docker image to use. Defaults to GitHub container registry."
37+
required: false
38+
default: ghcr.io
39+
type: string
40+
image_name:
41+
description: "Docker image name to use. Defaults to repository name."
42+
required: false
43+
default: ${{ github.repository }}
44+
type: string
45+
registry_username:
46+
description: "Username to use for registry login. Defaults to GitHub actor."
47+
required: false
48+
type: string
49+
registry_token:
50+
description: "Token to use for registry login. Defaults to GITHUB_TOKEN."
51+
required: false
52+
type: string
53+
fetch_submodules:
54+
description: "Fetch submodules. Defaults to true."
55+
required: false
56+
default: true
57+
type: boolean
58+
platforms:
59+
description: "Platforms to build for (comma separated, e.g., linux/amd64,linux/arm64)."
60+
required: false
61+
default: linux/amd64
62+
type: string
63+
runner:
64+
description: "Runner to use for the job. Defaults to ubuntu-latest."
65+
required: false
66+
default: ubuntu-latest
67+
type: string
68+
cacheFrom:
69+
description: "Cache type from"
70+
required: false
71+
type: string
72+
default: type=gha
73+
cacheTo:
74+
description: "Cache type to"
75+
required: false
76+
type: string
77+
default: type=gha,mode=max
78+
commit:
79+
description: "Commit SHA to use for git operations and tagging. Defaults to github.sha."
80+
required: false
81+
default: ${{ github.sha }}
82+
type: string
83+
84+
jobs:
85+
docker:
86+
uses: the0mikkel/ci/.github/workflows/docker.yml@v1.4.1
87+
if: github.repository == inputs.repository
88+
permissions:
89+
contents: read
90+
packages: write
91+
id-token: write
92+
with:
93+
dockerfile: ${{ inputs.dockerfile }}
94+
context: ${{ inputs.context }}
95+
arguments: ${{ inputs.arguments }}
96+
semver: ${{ inputs.semver }}
97+
tags: ${{ inputs.tags }}
98+
registry: ${{ inputs.registry }}
99+
image_name: ${{ inputs.image_name }}
100+
registry_username: ${{ inputs.registry_username }}
101+
registry_token: ${{ inputs.registry_token }}
102+
fetch_submodules: ${{ inputs.fetch_submodules }}
103+
platforms: ${{ inputs.platforms }}
104+
runner: ${{ inputs.runner }}
105+
cacheFrom: ${{ inputs.cacheFrom }}
106+
cacheTo: ${{ inputs.cacheTo }}
107+
commit: ${{ inputs.commit }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_call:
99
inputs:
1010
repository:
11-
description: "The repository to release"
11+
description: "Allowed repository for workflow to run in. Example `ctfpilot/hello-world`."
1212
required: true
1313
type: string
1414
ENVIRONMENT:
@@ -37,4 +37,4 @@ jobs:
3737
uses: the0mikkel/ci/.github/workflows/semver-release-standalone.yml@v1.4.1
3838
secrets: inherit
3939
with:
40-
ENVIRONMENT: ENVIRONMENT
40+
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}

README.md

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> [!IMPORTANT]
44
> This CI repository is meant for internal usage within the CTFPilot organization.
55
6-
This repository contains Continuous intergration automation, in the forms of Github Action workflows.
6+
This repository contains Continuous intergration automation, in the forms of GitHub Action workflows.
77

88
## How to use
99

@@ -20,7 +20,7 @@ jobs:
2020
permissions:
2121
<permissions>
2222
name: <name>
23-
uses: ctfpilot/ci/.github/workflows/<workflow>@<version>
23+
uses: ctfpilot/ci/.github/workflows/<workflow>.yml@<version>
2424
with:
2525
<inputs>
2626
```
@@ -29,16 +29,19 @@ jobs:
2929
3030
- [`cla-assistant`](#cla-assistant): CLA Assistant bot
3131
- [`release`](#release): Release system
32+
- [`docker`](#docker): Docker build and push system
3233

3334
### CLA Assistant
3435

35-
This workflow contains the CLA Assistant bot used througout CTF Pilot.
36+
This workflow contains the CLA Assistant bot used throughout CTF Pilot.
3637

3738
It is setup to contain sensible defaults, but requires the `repository` input to be specified.
3839

40+
The workflow can only be run within the `ctfpilot` organization.
41+
3942
#### Inputs
4043

41-
- `repository`: The repository that the CLA is generated for
44+
- `repository`: The repository that the CLA is generated for. Example `hello-world`.
4245
- `version`: CLA version. Keep default to use organization default.
4346
- `CLASHA`: The SHA for the commit, the CLA version is. Keep default to use organization default.
4447

@@ -65,20 +68,21 @@ jobs:
6568
pull-requests: write
6669
statuses: write
6770
name: "CLA Assistant"
68-
uses: ctfpilot/ci/.github/workflows/cla-assistant@<version>
71+
uses: ctfpilot/ci/.github/workflows/cla-assistant.yml@<version>
72+
secrets: inherit
6973
with:
7074
repository: <repository>
7175
```
7276

7377
### Release
7478

75-
This workflow contains the release system used througout CTF Pilot.
79+
This workflow contains the release system used throughout CTF Pilot.
7680

77-
The wofklow requires the `repository` input to be specified.
81+
The workflow requires the `repository` input to be specified.
7882

7983
#### Inputs
8084

81-
- `repository`: The repository that the CLA is generated for
85+
- `repository`: Allowed repository for workflow to run in. Example `ctfpilot/hello-world`.
8286
- `ENVIRONMENT`: The environment to deploy to.
8387

8488
#### Secrets
@@ -108,7 +112,55 @@ jobs:
108112
packages: write
109113
id-token: write
110114
name: "Release"
111-
uses: ctfpilot/ci/.github/workflows/release@<version>
115+
uses: ctfpilot/ci/.github/workflows/release.yml@<version>
116+
with:
117+
repository: <repository>
118+
```
119+
120+
### Docker
121+
122+
This workflow contains the Docker build and push system used throughout CTF Pilot.
123+
124+
The workflow requires the `repository` input to be specified.
125+
126+
#### Inputs
127+
128+
- `repository`: Allowed repository for workflow to run in. Example `ctfpilot/hello-world`.
129+
- `dockerfile`: Dockerfile path.
130+
- `context`: Build context.
131+
- `arguments`: Build arguments. List of key-value pairs.
132+
- `semver`: Semantic version. Leave empty to not use semantic versioning.
133+
- `tags`: List of tags to apply to the image. Required if you do not use semantic versioning.
134+
- `registry`: Registry for docker image to use. Defaults to GitHub container registry.
135+
- `image_name`: Docker image name to use. Defaults to repository name.
136+
- `registry_username`: Username to use for registry login. Defaults to GitHub actor.
137+
- `registry_token`: Token to use for registry login. Defaults to GITHUB_TOKEN.
138+
- `fetch_submodules`: Fetch submodules. Defaults to true.
139+
- `platforms`: Platforms to build for (comma separated, e.g., linux/amd64,linux/arm64).
140+
- `runner`: Runner to use for the job. Defaults to ubuntu-latest
141+
- `cacheFrom`: Cache type from
142+
- `cacheTo`: Cache type to
143+
- `commit`: Commit SHA to use for git operations and tagging. Defaults to github.sha.
144+
145+
#### How to use
146+
147+
```yml
148+
name: "Docker build and push"
149+
150+
on:
151+
push:
152+
branches:
153+
- main
154+
- develop
155+
156+
jobs:
157+
CLAAssistant:
158+
permissions:
159+
contents: read
160+
packages: write
161+
id-token: write
162+
name: "Docker build and push"
163+
uses: ctfpilot/ci/.github/workflows/docker.yml@<version>
112164
with:
113165
repository: <repository>
114166
```

0 commit comments

Comments
 (0)