Skip to content

Update CI release

Update CI release #5

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "master" ]
tags: "v*"
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
matrix:
os: [macos, ubuntu, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: Metadata
shell: bash
run: |
if ${{ startsWith(github.ref, 'refs/tags/v') }}; then
echo "BUILD_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
else
echo "BUILD_VERSION=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Build
run: go build -o dr-feeder -trimpath -ldflags "-X main.version=${BUILD_VERSION} -s -w"
- name: Test
run: go test -v ./...
- name: Package
shell: bash
run: tar czf "dr-feeder-${BUILD_VERSION}-${{ matrix.os }}.tar.gz" "./dr-feeder" "./config.yaml"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dr-feeder-${{ matrix.os }}
path: ./*.tar.gz
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "*.tar.gz"