Skip to content

Commit 4bed4cb

Browse files
authored
Merge pull request #141 from w568w/master
Create GitHub Action for release
2 parents d5584eb + d85dc05 commit 4bed4cb

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build artifacts & Release
2+
3+
on:
4+
schedule:
5+
- cron: "0 4 * * *"
6+
workflow_dispatch:
7+
inputs:
8+
tag_name:
9+
description: "Tag name for release"
10+
required: false
11+
default: nightly
12+
push:
13+
tags:
14+
- v[0-9]+.[0-9]+.[0-9]+*
15+
16+
jobs:
17+
release:
18+
permissions:
19+
contents: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Setup Go
25+
uses: actions/setup-go@v3
26+
with:
27+
go-version: "stable"
28+
- name: Build
29+
run: sh ./release.sh
30+
- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
31+
name: Release Nightly
32+
uses: softprops/action-gh-release@v1
33+
with:
34+
files: release/ink*
35+
prerelease: true
36+
tag_name: nightly
37+
name: Nightly build
38+
generate_release_notes: true
39+
fail_on_unmatched_files: true
40+
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
41+
name: Release
42+
uses: softprops/action-gh-release@v1
43+
with:
44+
files: release/ink*
45+
prerelease: false
46+
name: Release ${{ github.ref }}
47+
generate_release_notes: true
48+
fail_on_unmatched_files: true

release.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
build () {
66
echo "building for $1 $2..."
77
suffix=""
8-
if [ $1 == "windows" ]
8+
if [ $1 = "windows" ]
99
then
1010
suffix=".exe"
1111
fi
1212
GOOS=$1 GOARCH=$2 go build -o release/ink$suffix
1313
cd release
14-
if [ $1 == "linux" ]
14+
if [ $1 = "linux" ]
1515
then
1616
tar cvf - blog/* ink$suffix | gzip -9 - > ink_$1_$2.tar.gz
1717
else
@@ -28,8 +28,15 @@ rsync -av template/* release/blog --delete --exclude public --exclude theme/node
2828

2929
build linux 386
3030
build linux amd64
31+
build linux arm
32+
build linux arm64
33+
3134
build darwin amd64
35+
build darwin arm64
36+
3237
build windows 386
3338
build windows amd64
39+
build windows arm
40+
build windows arm64
3441

3542
rm -rf release/blog

0 commit comments

Comments
 (0)