diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c716f0f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Build artifacts & Release + +on: + schedule: + - cron: "0 4 * * *" + workflow_dispatch: + inputs: + tag_name: + description: "Tag name for release" + required: false + default: nightly + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+* + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: "stable" + - name: Build + run: sh ./release.sh + - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') + name: Release Nightly + uses: softprops/action-gh-release@v1 + with: + files: release/ink* + prerelease: true + tag_name: nightly + name: Nightly build + generate_release_notes: true + fail_on_unmatched_files: true + - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + name: Release + uses: softprops/action-gh-release@v1 + with: + files: release/ink* + prerelease: false + name: Release ${{ github.ref }} + generate_release_notes: true + fail_on_unmatched_files: true diff --git a/release.sh b/release.sh index a0170a6..01105e1 100755 --- a/release.sh +++ b/release.sh @@ -5,13 +5,13 @@ build () { echo "building for $1 $2..." suffix="" - if [ $1 == "windows" ] + if [ $1 = "windows" ] then suffix=".exe" fi GOOS=$1 GOARCH=$2 go build -o release/ink$suffix cd release - if [ $1 == "linux" ] + if [ $1 = "linux" ] then tar cvf - blog/* ink$suffix | gzip -9 - > ink_$1_$2.tar.gz else @@ -28,8 +28,15 @@ rsync -av template/* release/blog --delete --exclude public --exclude theme/node build linux 386 build linux amd64 +build linux arm +build linux arm64 + build darwin amd64 +build darwin arm64 + build windows 386 build windows amd64 +build windows arm +build windows arm64 rm -rf release/blog