From 1b6236e214f3c2b098cdd6b6d0f9a50ea0a09e31 Mon Sep 17 00:00:00 2001 From: Prawirdani Date: Tue, 30 Jul 2024 21:03:20 +0700 Subject: [PATCH] add release workflows --- .github/workflows/ci.yml | 3 ++- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cde7878..8216f9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,10 @@ name: CI on: + push: + branches: [ "master" ] pull_request: branches: [ "master" ] - workflow_dispatch: jobs: test: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2a05051 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Create Release + +on: + push: + tags: + - 'v*' +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Retrieve Go version from go.mod + id: get-go-version + run: | + go_version=$(go mod edit -json | jq -r .Go) + echo "GO_VERSION=${go_version}" >> $GITHUB_ENV + echo "Go version is $go_version" + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Verify Dependencies + run: go mod verify + + - name: Run Test + script: | + go get -d -v ./... + go test -race -v ./... + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false