Skip to content

Commit

Permalink
Add automated GH releases
Browse files Browse the repository at this point in the history
  • Loading branch information
drohit-cb committed May 2, 2024
1 parent 3aea706 commit e9a80f8
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 30 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/test.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go Test
name: CI

on:
push:
Expand All @@ -12,7 +12,8 @@ permissions:
contents: read

jobs:
test:
ci:
name: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,5 +26,11 @@ jobs:
- name: Build
run: go build -v ./...

- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54.2
args: --timeout=3m

- name: Test
uses: robherley/go-test-action@v0
28 changes: 0 additions & 28 deletions .github/workflows/lint.yaml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Version 🔖

on:
push:
branches:
- main
paths:
- '.version'

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get version from .version file
id: release_version
run: echo "VERSION=$(cat .version")" >> $GITHUB_OUTPUT

- name: Check if tag exists
id: check_tag
run: |
git fetch --tags
if git rev-parse "v${{ steps.release_version.outputs.VERSION }}" >/dev/null 2>&1; then
echo "::set-output name=EXISTS::true"
fi
- name: Create Release
if: steps.check_tag.outputs.EXISTS != 'true'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.release_version.outputs.VERSION }}
name: Release v${{ steps.release_version.outputs.VERSION }}
draft: false
prerelease: false
generate_release_notes: true
make_latest: true
1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.5.0

0 comments on commit e9a80f8

Please sign in to comment.