5
5
release :
6
6
types : [ released ]
7
7
jobs :
8
- publish :
9
- runs-on : ubuntu-latest
10
- steps :
11
- - uses : actions/checkout@v3
12
- if : ${{ startsWith(github.event.release.tag_name, 'v1.' ) }}
13
- with :
14
- ref : " v1"
15
- - uses : actions/checkout@v3
16
- if : ${{ startsWith(github.event.release.tag_name, 'v2.') }}
17
- with :
18
- ref : " v2"
19
- - uses : actions/checkout@v3
20
- if : ${{ startsWith(github.event.release.tag_name, 'v3.') }}
21
- with :
22
- ref : " v3"
23
- - uses : actions/checkout@v3
24
- if : ${{ startsWith(github.event.release.tag_name, 'v4.') }}
25
- - name : Set up Java and Maven
26
- uses : actions/setup-java@v3
27
- with :
28
- java-version : 11
29
- distribution : temurin
30
- cache : ' maven'
31
- - name : change version to release version
32
- # Assume that RELEASE_VERSION will have form like: "v1.0.1". So we cut the "v"
33
- run : ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit
34
- env :
35
- RELEASE_VERSION : ${{ github.event.release.tag_name }}
36
- - name : change version to release version for bom module
37
- working-directory : ./operator-framework-bom
38
- run : ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit
39
- env :
40
- RELEASE_VERSION : ${{ github.event.release.tag_name }}
41
- - name : Release Maven package
42
- uses : samuelmeuli/action-maven-publish@v1
43
- with :
44
- maven_profiles : " release"
45
- gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
46
- gpg_passphrase : ${{ secrets.GPG_PASSPHRASE }}
47
- nexus_username : ${{ secrets.OSSRH_USERNAME }}
48
- nexus_password : ${{ secrets.OSSRH_TOKEN }}
49
-
50
8
51
- # This is separate job because there were issues with git after release step, was not able to commit changes. See history.
52
- update-working-version :
9
+ prepare-release :
53
10
runs-on : ubuntu-latest
54
- if : " !contains(github.event.release.tag_name, 'RC')"
11
+ env :
12
+ tmp_version_branch : ' '
13
+ outputs :
14
+ version_branch : ${{ steps.set-version-branch.outputs.version_branch }}
55
15
steps :
56
- - uses : actions/checkout@v3
57
- if : ${{ startsWith(github.event.release.tag_name, 'v1.' ) }}
58
- with :
59
- ref : " v1"
60
- - uses : actions/checkout@v3
61
- if : ${{ startsWith(github.event.release.tag_name, 'v2.') }}
62
- with :
63
- ref : " v2"
64
- - uses : actions/checkout@v3
65
- if : ${{ startsWith(github.event.release.tag_name, 'v3.') }}
66
- with :
67
- ref : " v3"
68
- - uses : actions/checkout@v3
69
- if : ${{ startsWith(github.event.release.tag_name, 'v4.') }}
70
- - name : Set up Java and Maven
71
- uses : actions/setup-java@v3
72
- with :
73
- java-version : 11
74
- distribution : temurin
75
- cache : ' maven'
76
- - name : change version to release version
16
+ - if : ${{ startsWith(github.event.release.tag_name, 'v1.' ) }}
17
+ run : |
18
+ echo "Setting version_branch to v1"
19
+ echo "tmp_version_branch=v1" >> "$GITHUB_ENV"
20
+ - if : ${{ startsWith(github.event.release.tag_name, 'v2.' ) }}
21
+ run : |
22
+ echo "Setting version_branch to v2"
23
+ echo "tmp_version_branch=v2" >> "$GITHUB_ENV"
24
+ - if : ${{ startsWith(github.event.release.tag_name, 'v3.' ) }}
77
25
run : |
78
- ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit
79
- ./mvnw ${MAVEN_ARGS} -q build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
80
- git config --local user.email "[email protected] "
81
- git config --local user.name "GitHub Action"
82
- git commit -m "Set new SNAPSHOT version into pom files." -a
83
- env :
84
- RELEASE_VERSION : ${{ github.event.release.tag_name }}
85
- - name : Push changes v1
86
- uses : ad-m/github-push-action@master
87
- if : ${{ startsWith(github.event.release.tag_name, 'v1.' ) }}
88
- with :
89
- github_token : ${{ secrets.GITHUB_TOKEN }}
90
- branch : " v1"
91
- - name : Push changes v2
92
- uses : ad-m/github-push-action@master
93
- if : ${{ startsWith(github.event.release.tag_name, 'v2.' ) }}
94
- with :
95
- github_token : ${{ secrets.GITHUB_TOKEN }}
96
- branch : " v2"
97
- - name : Push changes v3
98
- uses : ad-m/github-push-action@master
99
- if : ${{ startsWith(github.event.release.tag_name, 'v3.' ) }}
100
- with :
101
- github_token : ${{ secrets.GITHUB_TOKEN }}
102
- branch : " v3"
103
- - name : Push changes v4
104
- uses : ad-m/github-push-action@master
105
- if : ${{ startsWith(github.event.release.tag_name, 'v4.' ) }}
106
- with :
107
- github_token : ${{ secrets.GITHUB_TOKEN }}
26
+ echo "Setting version_branch to v3"
27
+ echo "tmp_version_branch=v3" >> "$GITHUB_ENV"
28
+ - if : ${{ startsWith(github.event.release.tag_name, 'v4.' ) }}
29
+ run : |
30
+ echo "Setting version_branch to main"
31
+ echo "tmp_version_branch=main" >> "$GITHUB_ENV"
32
+ - if : ${{ env.tmp_version_branch == '' }}
33
+ name : Fail if version_branch is not set
34
+ run : |
35
+ echo "Failed to find appropriate branch to release ${{github.event.release.tag_name}} from"
36
+ exit 1
37
+ - id : set-version-branch
38
+ name : Set version_branch if matched
39
+ run : echo "::set-output name=version_branch::$tmp_version_branch"
40
+
41
+ release-sdk :
42
+ needs : prepare-release
43
+ uses : ./.github/workflows/release-project-in-dir.yml
44
+ with :
45
+ version_branch : ${{needs.prepare-release.outputs.version_branch}}
46
+ project_dir : ' .'
108
47
48
+ release-bom :
49
+ needs : prepare-release
50
+ uses : ./.github/workflows/release-project-in-dir.yml
51
+ with :
52
+ version_branch : ${{needs.prepare-release.outputs.version_branch}}
53
+ project_dir : ' ./operator-framework-bom'
0 commit comments