-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow publishing binaries via GitHub (#10)
- Loading branch information
Showing
7 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Release | ||
run-name: Release version ${{ github.event.inputs.version }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to release' | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
BINARY_VERSION: ${{ github.event.inputs.version }} | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure git | ||
run: | | ||
git config --global user.name '${{ github.actor }}' | ||
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | ||
- uses: actions/checkout@v4 | ||
- name: Check version format | ||
run: | | ||
bin/check-version.pl | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: './go.mod' | ||
- name: Build | ||
run: | | ||
bin/build-binaries.sh | ||
- name: Tag | ||
run: | | ||
git tag -a v${{ env.BINARY_VERSION }} -m "Release version ${{ env.BINARY_VERSION }}" | ||
git push origin --tags | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
out/* | ||
tag_name: ${{ env.BINARY_VERSION }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/out | ||
/test | ||
gen-elm-wrappers | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
: ${BINARY_VERSION?} | ||
|
||
list-binaries-to-build() { | ||
# DAVE: extract this from suitable json file | ||
echo darwin amd64 | ||
echo darwin arm64 | ||
echo linux amd64 | ||
echo windows amd64 | ||
} | ||
|
||
rm -rf out | ||
mkdir out | ||
|
||
list-binaries-to-build | while read GOOS GOARCH ; do | ||
case $GOOS in | ||
windows) | ||
BINARY_EXT=.exe | ||
;; | ||
*) | ||
BINARY_EXT='' | ||
;; | ||
esac | ||
BINARY_NAME="out/gen-elm-wrappers-$GOOS-$GOARCH-$BINARY_VERSION$BINARY_EXT" | ||
export GOOS GOARCH BINARY_EXT BINARY_NAME | ||
bin/build-binary.sh | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
if [[ -z "$BINARY_VERSION" ]] ; then | ||
printf 'BINARY_VERSION not set\n' >&2 | ||
exit 1 | ||
fi | ||
: ${BINARY_NAME?} | ||
: ${BINARY_VERSION?} | ||
|
||
go build \ | ||
-o gen-elm-wrappers \ | ||
-o "$BINARY_NAME" \ | ||
-ldflags "-X main.Version=$BINARY_VERSION" \ | ||
github.com/dave4420/gen-elm-wrappers/src |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env perl | ||
use warnings; | ||
use strict; | ||
|
||
local $_ = $ENV{BINARY_VERSION}; | ||
|
||
die "BINARY_VERSION is not set\n" unless defined; | ||
|
||
die "Version must be in the format X.Y.Z\n" unless /^\d+\.\d+\.\d+$/; | ||
|
||
print "Version is in the correct format\n"; |
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
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