Skip to content

Commit

Permalink
feat: added CI and Release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-wz committed Feb 25, 2024
1 parent e3c1297 commit 98bfa87
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: [ '*' ]
paths:
- '**.go'
- '.github/workflows/**.yml'
pull_request:
branches: [ main ]
workflow_call:

jobs:
lint:
name: lint files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup GO
uses: actions/setup-go@v4
with:
go-version: ${{ env.CAM_GO_VERSION }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 5m

build:
needs: [ lint ]
name: build go app
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env.CAM_GO_VERSION }}
- name: Build go app
run: go build -o bin/app ./cmd/http-rest-api/...
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI Release

on:
push:
tags: [ 'v*' ] # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
ci:
uses: ./.github/workflows/ci.yml

release:
name: Release / Create github release
needs: [ ci ]
runs-on: ubuntu-latest
if: success() && startsWith(github.ref_name, 'v') && github.ref_type == 'tag'
outputs:
RELEASE_URL: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit 98bfa87

Please sign in to comment.