-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (76 loc) · 2.8 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
name: Create release
on:
push:
tags:
- 'v*'
jobs:
test_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run Test
id: run_test
shell: pwsh
run: ./build.ps1 -Task Test -Bootstrap
- name: Create tests reports
id: test_module
uses: zyborg/pester-tests-report@v1
with:
test_results_path: tests/out/testResults.xml
exclude_tags: skip_ci
report_name: "module_tests_${{ matrix.os }}"
report_title: My Module Tests
github_token: ${{ secrets.GITHUB_TOKEN }}
output_level: diagnostic
tests_fail_step: true
- name: Release on Powershell Gallery
shell: pwsh
run: |
$ModuleVersion = "${{github.ref_name}}" -replace ('[a-zA-Z\-]', '')
Update-ModuleManifest -Path ./BioNameGenerator/BioNameGenerator.psd1 -ModuleVersion $ModuleVersion
Publish-Module -Path ./BioNameGenerator -NuGetApiKey ${{ secrets.PSGALLERY_KEY }}
- name: Generate a release name
shell: pwsh
id: gen_release
run: |
Install-Module BioNameGenerator
$VersionName = $(Get-RandomPhrase -Start Aminoacids -Middle Brazilian -End Species -Delimiter " ").ToLower()
echo "::set-output name=random_name::$VersionName"
- name: Build Changelog
id: build_changelog
uses: Bullrich/generate-release-changelog@master
env:
REPO: ${{ github.repository }}
- name: Clean Changelog
id: modified
run: |
set -o noglob
log=$(cat << "EOF" | grep -v :robot:| tac
${{steps.build_changelog.outputs.changelog}}
EOF
)
log="${log//'%'/'%25'}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
echo "::set-output name=modified::$log"
- name: Write Changelog
run: |
echo "## ${{github.ref_name}} - ${{ steps.gen_release.outputs.random_name}}" >> release_body.md
echo "${{ steps.modified.outputs.modified }}" >> release_body.md
echo "## ${{github.ref_name}} - ${{ steps.gen_release.outputs.random_name}}" >> CHANGELOG.md
echo "${{ steps.modified.outputs.modified }}" >> CHANGELOG.md
- name: Commit Changelog
uses: EndBug/add-and-commit@v7
with:
branch: main
message: ':robot: create changelog and update ModuleManifest'
add: "CHANGELOG.md,BioNameGenerator/BioNameGenerator.psd1"
- name: Release on Github
uses: ncipollo/release-action@v1
with:
name: "${{github.ref_name}}"
artifacts: "LICENSE,CHANGELOG.md"
bodyFile: "release_body.md"
token: ${{ secrets.GITHUB_TOKEN }}