-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (115 loc) · 3.53 KB
/
release.yaml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release
on:
push:
branches:
- workflow_release
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha'
- 'v[0-9]+.[0-9]+.[0-9]+-beta'
jobs:
release:
name: release
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write
id-token: write
contents: write
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install documentation tool
run: dotnet tool update -g docfx
shell: bash
- name: Checkout repository
uses: actions/checkout@v4
- name: Gather release info
id: info
run: |
ref_name='${{ github.ref_name }}'
echo "ref_name: $ref_name"
# is this a test release, or a real release?
if [[ "$ref_name" == 'workflow_release' ]]; then
version='v0.0.0-test'
else
version="$ref_name"
fi
echo "version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
shell: bash
- name: Create staging dir
id: staging
run: |
staging='Mech3DotNet-${{ steps.info.outputs.version }}'
mkdir "$staging"
cp {README.md,LICENSE} "$staging/"
echo "staging=$staging" >> $GITHUB_OUTPUT
shell: bash
- name: Run dotnet restore
run: dotnet restore
shell: bash
- name: Run dotnet build
id: build
run: >
dotnet build
--no-incremental
--no-restore
--configuration 'Release'
--output '${{ steps.staging.outputs.staging }}'
Mech3DotNet
shell: bash
- name: Package archives
id: package
run: |
mkdir 'assets'
tar czvf 'assets/${{ steps.staging.outputs.staging }}.tar.gz' '${{ steps.staging.outputs.staging }}'
7z a 'assets/${{ steps.staging.outputs.staging }}.zip' '${{ steps.staging.outputs.staging }}'
ls -1R assets/*
shell: bash
- name: Generate documentation
run: docfx Docs/docfx.json
shell: bash
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: Docs/_site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
version='${{ steps.info.outputs.version }}'
echo "version: $version"
# empty arguments
set --
# is this a test release, or a real release?
if [[ "$version" == 'v0.0.0-test' ]]; then
set -- "$@" --target '${{ github.sha }}'
fi
# is this a pre-release (-rc*, -alpha, -beta, -test)?
if [[ "$version" == *"-"* ]]; then
set -- "$@" --prerelease
fi
date=$(env TZ=':America/Los_Angeles' date +'%Y-%m-%d')
echo "date: $date"
echo "args: $@"
set -x
gh release create \
"$version" \
assets/* \
--title "$version ($date)" \
--draft \
--repo '${{ github.repository }}' \
"$@"
shell: bash