Skip to content

Merge pull request #83 from flownative/task/update-db-version #110

Merge pull request #83 from flownative/task/update-db-version

Merge pull request #83 from flownative/task/update-db-version #110

Workflow file for this run

name: Build
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
darwin_sha256sum: ${{ steps.calculate-checksums-darwin.outputs.darwin_sha256sum }}
linux_sha256sum: ${{ steps.calculate-checksums-linux.outputs.linux_sha256sum }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: '1.22'
id: go
- name: Get dependencies
run: |
go generate -v
go install -v
- name: Build
run: |
targets=${@-"darwin/amd64 linux/amd64"}
for target in $targets; do
os="$(echo $target | cut -d '/' -f1)"
arch="$(echo $target | cut -d '/' -f2)"
echo "--> Building project for: ${os}/${arch}"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -ldflags "-X github.com/flownative/localbeach/pkg/version.Version=${GITHUB_REF#refs/*/}" -o beach .
zip "beach_${os}_${arch}.zip" beach
ls -la
done
- name: Archive build result (darwin)
uses: actions/upload-artifact@v4
with:
name: beach-osx
path: beach_darwin_amd64.zip
- name: Archive build result (linux)
uses: actions/upload-artifact@v4
with:
name: beach-linux
path: beach_linux_amd64.zip
- name: Create Release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "beach_linux_amd64.zip,beach_darwin_amd64.zip"
artifactContentType: application/zip
generateReleaseNotes: false
makeLatest: true
name: Release ${{ github.ref }}
- name: Calculate checksum (darwin)
id: calculate-checksums-darwin
run: echo "darwin_sha256sum=$(sha256sum beach_darwin_amd64.zip | awk '//{print $1}')" >> $GITHUB_OUTPUT
- name: Calculate checksum (linux)
id: calculate-checksums-linux
run: echo "linux_sha256sum=$(sha256sum beach_linux_amd64.zip | awk '//{print $1}')" >> $GITHUB_OUTPUT
homebrew:
name: Homebrew release
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out Go code
uses: actions/checkout@v4
- name: Check out Homebrew code
uses: actions/checkout@v4
with:
repository: flownative/homebrew-flownative
path: homebrew
- name: Copy formula template
run: cp .github/workflows/localbeach.rb.tpl homebrew/Formula/localbeach.rb
- name: Set RELEASE_VERSION env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# see: https://github.com/bluwy/substitute-string-action
- name: Substitute Homebrew variables
uses: bluwy/substitute-string-action@v3
with:
_input-file: homebrew/Formula/localbeach.rb
_output-file: homebrew/Formula/localbeach.rb
_format-key: "{{key}}"
env:
INPUT_VERSION: ${{ env.RELEASE_VERSION }}
INPUT_DARWIN_SHA256SUM: ${{ needs.build.outputs.darwin_sha256sum }}
INPUT_LINUX_SHA256SUM: ${{ needs.build.outputs.linux_sha256sum }}
- name: Commit update
run: |
cd homebrew
git config --local --unset-all "http.https://github.com/.extraheader"
git config --global user.email "[email protected]"
git config --global user.name "Flownative Bot"
git add Formula/localbeach.rb
git commit -m 'localbeach: update to ${{ github.ref }}'
- name: Push to git
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.FLOWNATIVE_BOT_TOKEN }}
repository: flownative/homebrew-flownative
directory: homebrew