forked from jenkinsci/jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (184 loc) · 6.42 KB
/
publish-release-artifact.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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Publish artifact
on:
release:
types: [published]
jobs:
determine-version:
runs-on: ubuntu-latest
outputs:
project-version: ${{ steps.set-version.outputs.project-version }}
is-lts: ${{ steps.set-version.outputs.is-lts }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- 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
echo "Version is $version, is_lts: $is_lts"
echo "::set-output name=is-lts::${is_lts}"
echo "::set-output name=project-version::$version"
war:
runs-on: ubuntu-latest
needs: determine-version
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 "::set-output name=file-name::$FILE_NAME"
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: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-war.outputs.file-name }}
asset_name: ${{ steps.fetch-war.outputs.file-name }}
asset_content_type: application/java-archive
debian:
runs-on: ubuntu-latest
needs: determine-version
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 "::set-output name=file-name::$FILE_NAME"
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: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-deb.outputs.file-name }}
asset_name: ${{ steps.fetch-deb.outputs.file-name }}
asset_content_type: application/vnd.debian.binary-package
redhat:
runs-on: ubuntu-latest
needs: determine-version
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.1.noarch.rpm
IS_LTS=${{ needs.determine-version.outputs.is-lts }}
echo "::set-output name=file-name::$FILE_NAME"
REPO=redhat
if [ ${IS_LTS} = 'true' ]
then
REPO=redhat-stable
fi
echo $REPO
wget -q https://get.jenkins.io/${REPO}/${FILE_NAME}
- name: Upload Release Asset
id: upload-rpm
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-rpm.outputs.file-name }}
asset_name: ${{ steps.fetch-rpm.outputs.file-name }}
asset_content_type: application/x-redhat-package-manager
windows:
runs-on: ubuntu-latest
needs: determine-version
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 "::set-output name=file-name::$FILE_NAME"
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: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-msi.outputs.file-name }}
asset_name: ${{ steps.fetch-msi.outputs.file-name }}
asset_content_type: application/octet-stream
suse:
runs-on: ubuntu-latest
needs: determine-version
steps:
- name: Fetch suse rpm
id: fetch-suse-rpm
if: always()
run: |
PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
echo $PROJECT_VERSION
# we need opensuse to the file
OUTPUT_FILE_NAME=jenkins-${PROJECT_VERSION}-1.2-opensuse.noarch.rpm
IS_LTS=${{ needs.determine-version.outputs.is-lts }}
echo "::set-output name=file-name::$OUTPUT_FILE_NAME"
REPO=opensuse
if [ ${IS_LTS} = 'true' ]
then
REPO=opensuse-stable
fi
echo $REPO
wget -q https://get.jenkins.io/${REPO}/jenkins-${PROJECT_VERSION}-1.2.noarch.rpm -O ${OUTPUT_FILE_NAME}
- name: Upload Release Asset
id: upload-suse-rpm
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-suse-rpm.outputs.file-name }}
asset_name: ${{ steps.fetch-suse-rpm.outputs.file-name }}
asset_content_type: application/x-redhat-package-manager