Skip to content

Commit

Permalink
.github/workflows/release.yml: add workflow for automatic releases
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSom3body committed Dec 29, 2024
1 parent fc412b3 commit 1ea7618
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Create release

on:
push:
tags:
- v*

permissions:
contents: write

jobs:
release:
name: Release pushed tag
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

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

- name: Compile go binary
env:
GOOS: linux
GOARCH: amd64
run: |
mkdir -p dist
go build -o dist/
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
--generate-notes \
-d
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release upload "$tag" dist/* --repo="$GITHUB_REPOSITORY"

0 comments on commit 1ea7618

Please sign in to comment.