Skip to content

Commit

Permalink
add release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalys committed Feb 7, 2024
1 parent a787c59 commit 861d277
Showing 1 changed file with 45 additions and 6 deletions.
51 changes: 45 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,35 @@ name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"

jobs:
env:
TAG_VERSION: ${{ github.ref_name }}
GO_VERSION: "1.21"
REGISTRY: ghcr.io

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

- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
- name: Cache
uses: actions/[email protected]
with:
Expand All @@ -27,7 +45,7 @@ jobs:
${{ runner.os }}-golang-
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21'

Expand All @@ -37,4 +55,25 @@ jobs:
- name: Build
run: make build


- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./builders/service.dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ github.repository }}:latest

release:
needs:
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
body: ${{ env.TAG_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true

0 comments on commit 861d277

Please sign in to comment.