check-build #52
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Upload to CDN | |
on: | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: 'Commit SHA' | |
required: false | |
version: | |
description: 'Version (should follow semver v1.2.3)' | |
required: false | |
push: | |
branches: | |
- master | |
- dorav/check-build | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.inputs.commit || 'master' }} | |
- name: Setup Go Environment | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Set BINARY_NAME | |
id: set_binary_name | |
env: | |
VERSION: ${{ github.event.inputs.version || 'v1' }} | |
run: | | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "BINARY_NAME=atlas-action-$VERSION" >> $GITHUB_ENV | |
- name: Compile Go Binary | |
run: | | |
go build -o $BINARY_NAME -ldflags "-X ariga.io/atlas-action/atlasaction.Version=${{ github.event.inputs.version || 'v1' }}" ./cmd/atlas-action | |
env: | |
CGO_ENABLED: 0 | |
- name: Install Atlas | |
uses: ariga/setup-atlas@v0 | |
- name: Check version | |
run: | | |
set -x | |
OUTPUT=$(./$BINARY_NAME --version) | |
echo "DORAV - got = $OUTPUT" | |
[ $(echo $OUTPUT | grep -i "^$VERSION") ] && echo Version=$OUTPUT || (echo "unexpected output: $OUTPUT, expected: $VERSION"; exit 1) |