Skip to content

Commit 871b183

Browse files
author
Julien Kassar
committed
ci(github): add GitHub workflows
1 parent caea190 commit 871b183

2 files changed

Lines changed: 128 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
ci:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
env:
14+
DAGGER_NO_NAG: "1"
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Call Dagger Function to lint commit message
20+
uses: dagger/dagger-for-github@8.0.0
21+
with:
22+
call: --source . lint-commit-msg --args '--last'
23+
24+
lint:
25+
runs-on: ubuntu-latest
26+
needs: [ci]
27+
permissions:
28+
contents: read
29+
env:
30+
DAGGER_NO_NAG: "1"
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Call Dagger Function to lint go files
36+
uses: dagger/dagger-for-github@8.0.0
37+
with:
38+
call: --source . lint-golang --check-only-modified-files=true
39+
40+
- name: Call Dagger Function to lint json files
41+
uses: dagger/dagger-for-github@8.0.0
42+
with:
43+
call: --source . lint-json-file --check-only-modified-files=true
44+
45+
format:
46+
runs-on: ubuntu-latest
47+
needs: [ci]
48+
permissions:
49+
contents: read
50+
env:
51+
DAGGER_NO_NAG: "1"
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Call Dagger Function to format go files
57+
uses: dagger/dagger-for-github@8.0.0
58+
with:
59+
call: --source . format-go --check-only-modified-files=true
60+
61+
build:
62+
runs-on: ubuntu-latest
63+
needs: [ci, lint, format]
64+
permissions:
65+
contents: read
66+
env:
67+
DAGGER_NO_NAG: "1"
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Call Dagger Function to build
73+
uses: dagger/dagger-for-github@8.0.0
74+
with:
75+
call: --source . build stdout

.github/workflows/release.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
env:
14+
DAGGER_NO_NAG: "1"
15+
outputs:
16+
tag: ${{ steps.get_tag.outputs.tag }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Call Dagger Function to release
22+
uses: dagger/dagger-for-github@8.0.0
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
with:
26+
call: --source . release --github-token env:GITHUB_TOKEN --ci=true --dry-run=false
27+
28+
- name: Set Output Tag
29+
id: get_tag
30+
run: |
31+
git fetch --tags --force
32+
echo "tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"
33+
34+
publish:
35+
runs-on: ubuntu-latest
36+
needs: [release]
37+
permissions:
38+
contents: read
39+
packages: write
40+
env:
41+
DAGGER_NO_NAG: "1"
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
ref: ${{ needs.release.outputs.tag }}
46+
fetch-depth: 0
47+
48+
- name: Call Dagger Function to build and push
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
uses: dagger/dagger-for-github@8.0.0
52+
with:
53+
call: --source . build publish --token env:GITHUB_TOKEN

0 commit comments

Comments
 (0)