Skip to content

chore(deps): bump deps #153

chore(deps): bump deps

chore(deps): bump deps #153

name: Build, Release, and Publish
on:
push:
branches: [ main ]
paths-ignore:
- 'README.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'README.md'
env:
GO_VERSION: '1.22'
BINARY_NAME: 'ingest'
permissions:
contents: write
packages: write
jobs:
build:
if: ${{ ! contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.pull_request.title, '[skip ci]')}}
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: darwin
arch: arm64
- os: linux
arch: amd64
- os: linux
arch: arm64
outputs:
version: ${{ steps.set_version.outputs.new_tag }}
changelog: ${{ steps.set_version.outputs.changelog }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Set up Go and cache dependencies
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Get version
id: set_version
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: Get dependencies
run: go mod download
- name: Run tests
run: go test -v ./...
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
VERSION: ${{ steps.set_version.outputs.new_tag }}
run: |
go build -v -ldflags "-X main.Version=$version" -o build/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }} .
ls -ltarh build/
- name: Upload artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: ${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
path: build/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
retention-days: 90
release:
name: Release
needs: build
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.pull_request.title, '[skip ci]')}}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
path: build/
- name: Create a GitHub release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1
if: ${{ startsWith(github.ref, 'refs/heads/main') && !contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.pull_request.title, '[skip ci]') }}
with:
tag: ${{ needs.build.outputs.version }}
name: ${{ needs.build.outputs.version }}
body: ${{ needs.build.outputs.changelog }}
skipIfReleaseExists: true
generateReleaseNotes: true
allowUpdates: true
makeLatest: ${{ startsWith(github.ref, 'refs/heads/main') && !contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.pull_request.title, '[skip ci]') }}
prerelease: ${{ !startsWith(github.ref, 'refs/heads/main') }}
artifactErrorsFailBuild: true
artifacts: |
build/${{ env.BINARY_NAME }}*/${{ env.BINARY_NAME }}*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}