-
Notifications
You must be signed in to change notification settings - Fork 65
102 lines (98 loc) · 5.48 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
name: Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "The release version in <MAJOR>.<MINOR>.<PATCH> format"
required: true
nextVersion:
description: "The next version in <MAJOR>.<MINOR> format WITHOUT SNAPSHOT SUFFIX"
required: true
prerelease:
description: "Preview release"
required: true
type: boolean
default: false
previewVersion:
description: "Preview version number, integer"
required: false
default: "1"
jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: "Check release version"
run: |
expr "${{ inputs.releaseVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$'
echo "release_version=${{ inputs.releaseVersion }}" >> $GITHUB_ENV
- name: "Check next version"
run: |
expr "${{ inputs.nextVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$'
- uses: actions/checkout@v4
with:
token: ${{ secrets.QAMETA_CI }}
- name: "Mark release as preview"
if: ${{ inputs.prerelease }}
run: |
echo "release_version=${{ inputs.releaseVersion }}-preview.${{ inputs.previewVersion }}" >> $GITHUB_ENV
- name: "Configure CI Git User"
run: |
git config --global user.name qameta-ci
git config --global user.email [email protected]
- name: "Set release version"
run: |
sed -i -e '/<PropertyGroup>/,/<\/PropertyGroup>/ s|<Version>[0-9a-zA-Z.|-]*</Version>|<Version>${{ env.release_version }}</Version>|g' ./Directory.Build.props
cat ./Directory.Build.props
- name: "Update schema links"
run: |
sed -i -e '/"$ref"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.NUnit/Schemas/allureConfig.schema.json
cat ./Allure.NUnit/Schemas/allureConfig.schema.json
sed -i -e '/"$ref"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.Xunit/Schemas/allureConfig.schema.json
cat ./Allure.Xunit/Schemas/allureConfig.schema.json
sed -i -e '/"$ref"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.SpecFlow/Schemas/allureConfig.schema.json
cat ./Allure.SpecFlow/Schemas/allureConfig.schema.json
sed -i -e '/"$ref"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.Reqnroll/Schemas/allureConfig.schema.json
cat ./Allure.Reqnroll/Schemas/allureConfig.schema.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.Net.Commons/allureConfig.Template.json
cat ./Allure.Net.Commons/allureConfig.Template.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.NUnit.Examples/allureConfig.json
cat ./Allure.NUnit.Examples/allureConfig.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.Xunit.Examples/allureConfig.json
cat ./Allure.Xunit.Examples/allureConfig.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.SpecFlow/allureConfig.Template.json
cat ./Allure.SpecFlow/allureConfig.Template.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.SpecFlow.Tests.Samples/allureConfig.json
cat ./Allure.SpecFlow.Tests.Samples/allureConfig.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.SpecFlow.Tests/allureConfig.json
cat ./Allure.SpecFlow.Tests/allureConfig.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.Reqnroll/allureConfig.Template.json
cat ./Allure.Reqnroll/allureConfig.Template.json
sed -i -e '/"$schema"/s|/allure-csharp/[^/]*|/allure-csharp/${{ env.release_version }}|g' ./Allure.Reqnroll.Tests.Samples/allureConfig.json
cat ./Allure.Reqnroll.Tests.Samples/allureConfig.json
- name: "Update release notes link"
run: |
sed -i -e '/<PackageReleaseNotes>/,/<\/PackageReleaseNotes>/ s|/tag/[0-9a-zA-Z.|-]*|/tag/${{ env.release_version }}|g' ./Directory.Build.props
cat ./Directory.Build.props
- name: "Commit release version and create tag"
run: |
git commit -am "release ${{ env.release_version }}"
git tag ${{ env.release_version }}
git push origin ${{ env.release_version }}
- name: "Set next development version"
run: |
sed -i -e '/<PropertyGroup>/,/<\/PropertyGroup>/ s|<Version>[0-9a-zA-Z.|-]*</Version>|<Version>${{ inputs.nextVersion }}-SNAPSHOT</Version>|g' ./Directory.Build.props
cat ./Directory.Build.props
- name: "Commit next development version and push it"
run: |
git commit -am "set next development version ${{ inputs.nextVersion }}"
git push origin ${{ github.ref }}
- name: "Publish Github Release"
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/releases
tag_name: ${{ env.release_version }}
generate_release_notes: true
target_commitish: ${{ github.ref }}
prerelease: ${{ inputs.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.QAMETA_CI }}