Skip to content

Commit

Permalink
Add Github Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
watal committed Jun 13, 2023
1 parent 26de945 commit 4cfc779
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/.goalangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters-settings:
gocyclo:
min-complexity: 15
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "docker"
directory: "/build/package"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/examples/package"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: golangci-lint

on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/setup-go@v4
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
golangci_lint_flags: "--config=.github/.golangci.yml"
21 changes: 21 additions & 0 deletions .github/workflows/editerconfig-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: EditorConfig Checker

on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
editorconfig:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
52 changes: 52 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Push Docker image

on:
push:
branches-ignore:
- '**'
tags:
- 'v*'

env:
REGISTRY: ghcr.io

IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./build/package
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: goreleaser

on:
push:
tags:
- v[0-9]+.*

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
before:
hooks:
- go mod tidy
builds:
- id: fluvia
main: ./cmd/fluvia/
binary: fluvia
ldflags:
- -s -w -X main.build={{.Version}}
goos:
- linux
goarch:
- amd64
- 386
- arm
- arm64

archives:
- id: archive
rlcp: true
files:
- LICENSE
- CREDITS
- README.md

0 comments on commit 4cfc779

Please sign in to comment.