Skip to content

Commit

Permalink
add greenbone github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoetzegb committed Apr 16, 2024
1 parent 45ff0ac commit 1eb28cf
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 32 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '30 5 * * 0' # 5:30h on Sundays
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
16 changes: 16 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Conventional Commits

on:
pull_request:

permissions:
pull-requests: write
contents: read

jobs:
conventional-commits:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- name: Report Conventional Commits
uses: greenbone/actions/conventional-commits@v3
12 changes: 12 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Dependency Review'
uses: greenbone/actions/dependency-review@v3
7 changes: 3 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: Go

on:
push:
paths:
- "**.go"
branches:
- main
pull_request:
paths:
- "**.go"
workflow_dispatch:

jobs:
build:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/go_legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: Go

on:
push:
paths:
- "**.go"
branches:
- main
pull_request:
paths:
- "**.go"

jobs:
build:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: govulncheck

# check for vulnerabilities using `govulncheck`, compared to dependabot it only alerts if the affected code is actually called

on:
pull_request: # make sure there is no vulnerability added with a new feature
schedule: # check if used code of existing dependencies is vulnerable
- cron: '37 4 * * *' # daily 4:37h
workflow_dispatch: # on demand

jobs:
govulncheck:
runs-on: ubuntu-latest
name: Run govulncheck
steps:
- id: govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-file: ./go.mod
16 changes: 16 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/go-setup
- uses: golangci/golangci-lint-action@v4
47 changes: 23 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
name: Publish Go binaries to github release
name: Release
# with pontos

on:
release:
types: [created]
pull_request:
types: [closed]
workflow_dispatch:
inputs:
release-type:
type: choice
description: What kind of release do you want to do (pontos --release-type argument)?
options:
- patch
- minor
- major
release-version:
type: string
description: Set an explicit version, that will overwrite release-type. Fails if version is not compliant.

jobs:
releases-matrix:
name: Release Go binaries
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '^1.21.0'

- name: Build
run: make dist

- name: Upload release assets
uses: softprops/action-gh-release@v1
with:
files: |
dist/csaf_distribution-*.zip
dist/csaf_distribution-*.tar.gz
release:
name: csaf_distribution
uses: greenbone/workflows/.github/workflows/release-3rd-gen.yml@main
with:
release-type: ${{ inputs.release-type }}
release-version: ${{ inputs.release-version }}
secrets: inherit

0 comments on commit 1eb28cf

Please sign in to comment.