Skip to content

Commit

Permalink
Add GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Gchbg committed Mar 19, 2024
1 parent da6e552 commit 5443e32
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
commit-message:
prefix: ""
reviewers:
- Gchbg
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
commit-message:
prefix: ""
reviewers:
- Gchbg
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
commit-message:
prefix: ""
reviewers:
- Gchbg
49 changes: 49 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
- 'documentation'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
exclude-labels:
- 'skip-changelog'
autolabeler:
- label: 'documentation'
files:
- '**/*.md'
branch:
- '/docs{0,1}\/.+/'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- label: 'enhancement'
branch:
- '/feature\/.+/'
template: |
## Changes
$CHANGES
23 changes: 23 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Draft release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-drafter:
name: Draft release
runs-on: ubuntu-latest
steps:
- name: Draft release
uses: release-drafter/release-drafter@v6
with:
disable-releaser: github.ref != 'refs/heads/main'
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on: pull_request

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run linter
uses: golangci/golangci-lint-action@v4
70 changes: 70 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and publish docker image

env:
platforms: linux/amd64,linux/arm64

on:
push:
branches:
- main
tags:
- v*
pull_request:

permissions:
contents: read
packages: write

jobs:
publish-docker:
name: Build and publish Docker image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Collect metadata
uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/${{ github.repository_owner }}/metal
tags: |
type=semver,pattern={{version}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: ${{ env.platforms }}
- name: Set up Docker Buildx context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
timeout-minutes: 5
with:
version: latest
endpoint: builders
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
timeout-minutes: 60
with:
context: .
platforms: ${{ env.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
13 changes: 13 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check REUSE compliance

on: pull_request

jobs:
reuse:
name: Check REUSE compliance
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Run REUSE
uses: fsfe/reuse-action@v3
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test

on: pull_request

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: make test

0 comments on commit 5443e32

Please sign in to comment.