-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (104 loc) · 3.32 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: release
on:
push:
tags:
- "v*"
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
raw_tag: ${{ steps.get_version.outputs.VERSION }}
tag: ${{ steps.get_version.outputs.VERSION_NO_PREFIX }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.ref }}
release_name: Release ${{ github.event.ref }}
draft: false
prerelease: false
- name: Get the version
id: get_version
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
echo ::set-output name=VERSION_NO_PREFIX::${GITHUB_REF#refs/tags/v}
build:
name: Build binaries
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
goarch: [amd64]
runs-on: ${{ matrix.os }}
needs: create_release
env:
GOARCH: ${{ matrix.goarch }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build
id: build
env:
TUG_COMMIT: ${{ github.sha }}
TUG_VERSION: ${{ needs.create_release.outputs.tag }}
RAW_TAG: ${{ needs.create_release.outputs.raw_tag }}
run: |
make build
echo ::set-output name=ASSET_NAME::turbogit_${RAW_TAG}_$(go env GOOS)_$(go env GOARCH).tar.gz
- name: Package
env:
ASSET_NAME: ${{ steps.build.outputs.ASSET_NAME }}
run: tar -zcvf ${ASSET_NAME} -C dist/bin/ .
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASSET_NAME: ${{ steps.build.outputs.ASSET_NAME }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ env.ASSET_NAME }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: application/octet-stream
doc:
name: Deploy documentation
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
id: go
- name: Install doctave
run: |
mkdir -p $GITHUB_WORKSPACE/bin
curl -sSL https://github.com/Doctave/doctave/releases/download/0.4.2/doctave-0.4.2-x86_64-unknown-linux-musl.tar.gz | tar xvz
mv doctave-0.4.2-x86_64-unknown-linux-musl/doctave $GITHUB_WORKSPACE/bin/doctave
chmod +x $GITHUB_WORKSPACE/bin/doctave
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Build
run: make doc
- name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: gh-pages
build_dir: dist/doc/site
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}