Skip to content

Merge pull request #9 from salemove/fix-master-build #23

Merge pull request #9 from salemove/fix-master-build

Merge pull request #9 from salemove/fix-master-build #23

name: Release on master build
on:
push:
branches:
- master
env:
# Common versions
GO_VERSION: '1.22.4'
GOLANGCI_LINT_VERSION: '1.59.1'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_VERSION }}
- name: Run quality control checks
run: make vet
- name: Run tests
run: make test
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
os:
- linux
- darwin
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Create releases directory
run: mkdir releases
- name: Build
run: make build OUTPUT_PATH=releases/regexp_utility-${{ matrix.os }}-${{ matrix.arch }}
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
release:
runs-on: ubuntu-latest
needs:
- test
- build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate release tag
id: gen_tag
run: |
SHORT_REV=$(git rev-parse --short "$GITHUB_SHA")
echo "::set-output name=release_tag::release-$SHORT_REV"
- name: Push new tag
run: |
git tag ${{ steps.gen_tag.outputs.release_tag }}
git push origin master ${{ steps.gen_tag.outputs.release_tag }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.gen_tag.outputs.release_tag }}
generate_release_notes: true
files: |
releases/regexp_utility-*