Skip to content

Commit 5aaddd3

Browse files
committed
chore: add github workflows
1 parent 8c9c3dc commit 5aaddd3

3 files changed

Lines changed: 147 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Go modules
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10
9+
labels:
10+
- "dependencies"
11+
- "go"
12+
13+
# Enable version updates for GitHub Actions
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
open-pull-requests-limit: 5
19+
labels:
20+
- "dependencies"
21+
- "github-actions"

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Install svu
21+
run: |
22+
curl -sL https://github.com/caarlos0/svu/releases/download/v2.3.0/svu_2.3.0_linux_amd64.tar.gz | tar xvz
23+
sudo mv svu /usr/local/bin/
24+
25+
- name: Get current version
26+
id: current
27+
run: |
28+
CURRENT=$(svu current 2>/dev/null || echo "v0.0.0")
29+
echo "version=$CURRENT" >> $GITHUB_OUTPUT
30+
31+
- name: Calculate next patch version
32+
id: next
33+
run: |
34+
NEXT=$(svu patch)
35+
echo "version=$NEXT" >> $GITHUB_OUTPUT
36+
37+
- name: Check if version changed
38+
id: check
39+
run: |
40+
if [ "${{ steps.current.outputs.version }}" == "${{ steps.next.outputs.version }}" ]; then
41+
echo "changed=false" >> $GITHUB_OUTPUT
42+
echo "No new commits since last release"
43+
else
44+
echo "changed=true" >> $GITHUB_OUTPUT
45+
echo "New version: ${{ steps.next.outputs.version }}"
46+
fi
47+
48+
- name: Create and push tag
49+
if: steps.check.outputs.changed == 'true'
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git tag ${{ steps.next.outputs.version }}
54+
git push origin ${{ steps.next.outputs.version }}
55+
56+
- name: Create GitHub Release
57+
if: steps.check.outputs.changed == 'true'
58+
uses: actions/create-release@v1
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
with:
62+
tag_name: ${{ steps.next.outputs.version }}
63+
release_name: ${{ steps.next.outputs.version }}
64+
draft: false
65+
prerelease: false
66+
body: |
67+
Automated patch release ${{ steps.next.outputs.version }}
68+
69+
See [CHANGELOG](https://github.com/${{ github.repository }}/compare/${{ steps.current.outputs.version }}...${{ steps.next.outputs.version }}) for details.

.github/workflows/scorecard.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: OSSF Scorecard
2+
3+
on:
4+
# Only run on push to main branch
5+
push:
6+
branches:
7+
- main
8+
# Run weekly on Saturdays
9+
schedule:
10+
- cron: '30 1 * * 6'
11+
# Allow manual workflow dispatch
12+
workflow_dispatch:
13+
14+
# Declare default permissions as read only
15+
permissions: read-all
16+
17+
jobs:
18+
analysis:
19+
name: Scorecard analysis
20+
runs-on: ubuntu-latest
21+
permissions:
22+
# Needed to upload the results to code-scanning dashboard
23+
security-events: write
24+
# Needed to publish results
25+
id-token: write
26+
# Needed to checkout the repository
27+
contents: read
28+
# Needed for API requests
29+
actions: read
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
37+
- name: Run analysis
38+
uses: ossf/scorecard-action@v2.4.3
39+
with:
40+
results_file: results.sarif
41+
results_format: sarif
42+
# Publish results to enable scorecard badges
43+
publish_results: true
44+
45+
# Upload the results as artifacts (optional)
46+
- name: Upload artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: SARIF file
50+
path: results.sarif
51+
retention-days: 5
52+
53+
# Upload the results to GitHub's code scanning dashboard
54+
- name: Upload to code-scanning
55+
uses: github/codeql-action/upload-sarif@v3
56+
with:
57+
sarif_file: results.sarif

0 commit comments

Comments
 (0)