-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (68 loc) · 2.51 KB
/
release.yaml
File metadata and controls
84 lines (68 loc) · 2.51 KB
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
on:
push:
tags:
- 'v*'
name: Release
jobs:
release:
runs-on: ubuntu-latest
env:
RELEASE_NAME: cli
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- id: vars
name: Generate release vars
run: |
echo "::set-output name=version::"$(echo "${{ github.ref }}" | sed -r 's|refs/tags/v(.+)|\1|')""
echo "Changelog: " > release.md
git log --pretty=format:" - %s" "$(git describe --tags --abbrev=0 ${{ github.event.ref }}^)"..${{ github.event.ref }} >> release.md
- name: Cross compile with xgo
uses: crazy-max/ghaction-xgo@v1
with:
go_version: 1.16.x
pkg: cmd/netsoc
dest: bin
ldflags: '-X github.com/netsoc/cli/version.Version=v${{ steps.vars.outputs.version }}'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.RELEASE_NAME }} ${{ steps.vars.outputs.version }}
body_path: release.md
- name: Upload binaries to release
uses: AButler/upload-release-assets@v2.0
with:
files: 'bin/github.com/netsoc/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: v${{ steps.vars.outputs.version }}
- name: Generate reference documentation
run: |
rm -rf docs/reference/
mkdir -p docs/reference/
bin/github.com/netsoc/cli-linux-amd64 docs -t markdown -o docs/reference/
./gen_mkdocs_pages.py docs/reference/ > docs/reference/.pages
- id: stage_docs
name: Stage reference docs changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
changed="no"
git add docs/reference/
git diff-index --quiet HEAD -- || changed="yes"
echo "::set-output name=changed::$changed"
- name: Commit reference docs changes
if: ${{ steps.stage_docs.outputs.changed == 'yes' }}
run: git commit -m "Re-generate reference documentation"
- name: Push documentation
if: ${{ steps.stage_docs.outputs.changed == 'yes' }}
uses: ad-m/github-push-action@master
with:
# Use a PAT because we need to trigger a workflow run
github_token: '${{ secrets.CI_PAT }}'
tags: true