-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
189 lines (164 loc) · 5.77 KB
/
publish-release-artifact.yml
File metadata and controls
189 lines (164 loc) · 5.77 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Publish artifact
on:
release:
types: [published]
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
determine-version:
if: ${{ github.repository_owner == 'jenkinsci' }}
runs-on: ubuntu-latest
outputs:
project-version: ${{ steps.set-version.outputs.project-version }}
is-lts: ${{ steps.set-version.outputs.is-lts }}
is-rc: ${{ steps.set-version.outputs.is-rc }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up JDK 21
uses: actions/setup-java@d81c4e45f3ac973cc936d79104023e20054ba578 #v 5.0.0
with:
distribution: "temurin"
java-version: 21
cache: "maven"
- name: Set version
id: set-version
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
dot_count=$(echo $version | sed 's/[^.]//g' | awk '{ print length }')
if [ "${dot_count}" = '2' ]
then
is_lts=true
else
is_lts=false
fi
is_rc=false
if [[ ${version} == *"-SNAPSHOT" ]]; then
is_rc=true
fi
echo "Version is $version, is_lts: $is_lts, is_rc: $is_rc"
echo "is-lts=${is_lts}" >> $GITHUB_OUTPUT
echo "project-version=$version" >> $GITHUB_OUTPUT
echo "is-rc=${is_rc}" >> $GITHUB_OUTPUT
war:
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch war
id: fetch-war
run: |
FILE_NAME=jenkins.war
PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
IS_LTS=${{ needs.determine-version.outputs.is-lts }}
echo $PROJECT_VERSION
echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
REPO=war
if [ ${IS_LTS} = 'true' ]
then
REPO=war-stable
fi
echo $REPO
wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}
- name: Upload Release Asset
id: upload-war
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.fetch-war.outputs.file-name }}
debian:
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch Deb
id: fetch-deb
if: always()
run: |
PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
echo $PROJECT_VERSION
FILE_NAME=jenkins_${PROJECT_VERSION}_all.deb
IS_LTS=${{ needs.determine-version.outputs.is-lts }}
echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
REPO=debian
if [ ${IS_LTS} = 'true' ]
then
REPO=debian-stable
fi
echo $REPO
wget -q https://get.jenkins.io/${REPO}/${FILE_NAME}
- name: Upload Release Asset
id: upload-deb
if: always()
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.fetch-deb.outputs.file-name }}
rpm:
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch RPM
id: fetch-rpm
if: always()
run: |
PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
echo $PROJECT_VERSION
FILE_NAME=jenkins-${PROJECT_VERSION}-1.noarch.rpm
IS_LTS=${{ needs.determine-version.outputs.is-lts }}
echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
REPO=rpm
if [ ${IS_LTS} = 'true' ]
then
REPO=rpm-stable
FILE_NAME=jenkins-${PROJECT_VERSION}-1.1.noarch.rpm
fi
echo $REPO
wget -q https://get.jenkins.io/${REPO}/${FILE_NAME}
- name: Upload Release Asset
id: upload-rpm
if: always()
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.fetch-rpm.outputs.file-name }}
windows:
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch MSI
id: fetch-msi
if: always()
run: |
PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
echo $PROJECT_VERSION
FILE_NAME=jenkins.msi
IS_LTS=${{ needs.determine-version.outputs.is-lts }}
echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
REPO=windows
if [ ${IS_LTS} = 'true' ]
then
REPO=windows-stable
fi
echo $REPO
wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}
- name: Upload Release Asset
id: upload-msi
if: always()
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.fetch-msi.outputs.file-name }}