Skip to content

Commit

Permalink
add github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Seán C McCord <[email protected]>
  • Loading branch information
Ulexus committed Aug 26, 2021
1 parent 21c70bb commit 65444d1
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Go

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: lint
uses: golangci/[email protected]
with:
args: ./...

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
35 changes: 35 additions & 0 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Master branch push

on:
push:
branches: [ master ]

jobs:

image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: PrepareReg Names
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
echo IMAGE_TAG=$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{split($0,a,"/"); print a[3]}') >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: GHCR Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: GHCR Push
uses: docker/build-push-action@v2
with:
push: true
tags: |
ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.sha }}
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Docker Hub Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: GHCR Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: GoReleaser
uses: goreleaser/[email protected]
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 65444d1

Please sign in to comment.