-
Notifications
You must be signed in to change notification settings - Fork 409
152 lines (146 loc) · 6.87 KB
/
create_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
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release. (format: `YYYY.MM.mm`)'
required: true
jobs:
################
# Build
################
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
################
# Protect master branch
################
- name: Check branch
if: ${{ github.repository != 'geosolutions-it/MapStore2' || github.ref == 'master' }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('This workflow can not run on master branch')
- uses: actions/checkout@v3
- name: "checking out"
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: "setting up npm"
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: "setting up Java"
uses: actions/setup-java@v1
with:
java-version: '11.x'
############
# CACHING
##########
- name: "cache node modules"
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: "cache maven dependencies"
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: mapstore-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
mapstore-${{ runner.os }}-maven-
- name: Build
id: "build"
run: "./build.sh ${{ github.event.inputs.version }} binary,printingbundle"
- name: "Upload war"
uses: actions/upload-artifact@v3
with:
name: war
path: product/target/mapstore.war
- name: "Upload binary"
uses: actions/upload-artifact@v3
with:
name: binary
path: "binary/target/mapstore2-${{ github.event.inputs.version }}-bin.zip"
- name: "Upload printing"
uses: actions/upload-artifact@v3
with:
name: printing
path: "java/printing/target/mapstore-printing.zip"
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: "Download war"
uses: actions/download-artifact@v3
with:
path: artifacts/
- name: Display structure of downloaded files
run: ls -R
working-directory: artifacts
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: create_release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
commitish: ${{ github.ref }}
tag_name: "v${{ github.event.inputs.version }}"
release_name: "v${{ github.event.inputs.version }}"
body: |
## Main Features
- ...
## Main Improvements
- ...
## Useful links related to **[v${{ github.event.inputs.version }}](https://github.com/geosolutions-it/MapStore2/tree/v${{ github.event.inputs.version }})**
- **[Full Changelog](https://github.com/geosolutions-it/MapStore2/compare/v${{ github.event.inputs.previousVersion }}...v${{ github.event.inputs.version }})**
- **[Implemented enhancements](https://github.com/geosolutions-it/MapStore2/issues?q=is%3Aissue+milestone%3A%22${{ github.event.inputs.version }}%22+is%3Aclosed+label%3Aenhancement)**
- **[Fixed bugs](https://github.com/geosolutions-it/MapStore2/issues?q=is%3Aissue+milestone%3A%22${{ github.event.inputs.version }}%22+is%3Aclosed+label%3Abug)**
- **[Closed issues](https://github.com/geosolutions-it/MapStore2/issues?q=is%3Aissue+milestone%3A%22${{ github.event.inputs.version }}%22+is%3Aclosed)**
- **[MapStore Extension release v${{ github.event.inputs.version }}](https://github.com/geosolutions-it/MapStoreExtension/releases/tag/v${{ github.event.inputs.version }})**
- **[Docker image v${{ github.event.inputs.version }}](xxx)** `< TODO: add this link manually`
- **[MapStore documentation v${{ github.event.inputs.version }}](https://docs.mapstore.geosolutionsgroup.com/en/v${{ github.event.inputs.version }}/)**
draft: true
prerelease: false
- name: Upload Release war
id: upload-release-war
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: artifacts/war/mapstore.war
asset_name: mapstore.war
asset_content_type: application/zip
- name: Upload Release binary
id: upload-release-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: "artifacts/binary/mapstore2-${{github.event.inputs.version}}-bin.zip"
asset_name: "mapstore2-${{github.event.inputs.version}}-bin.zip"
asset_content_type: application/zip
- name: Upload Release printing
id: upload-release-printing
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: artifacts/printing/mapstore-printing.zip
asset_name: mapstore-printing.zip
asset_content_type: application/zip