generated from smatechnologies/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (129 loc) · 5.24 KB
/
ci.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
# Workflow triggering
on:
push:
branches:
- master
tags:
- 'v*'
name: Commvault
jobs:
###########
# PACKAGE #
###########
Job_Package:
runs-on: ubuntu-latest
name: Package
steps:
# Checkout the code
- name: Code checkout
uses: actions/checkout@master
# Prepare the environment with Java 11
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: 11
# Build the maven project, output into ./connector/commvault-dist/
- name: Build
run: mvn clean package --file connector/pom.xml
####################################
# Create Windows Distribution File #
####################################
# Download the latest GA OpenJDK JRE 11 from AdoptOpenJDK for Windows x64
- name: Get Java 11 JRE for Windows x64
run: curl -L "https://api.adoptopenjdk.net/v3/binary/latest/11/ga/windows/x64/jre/hotspot/normal/adoptopenjdk" --output java.zip
# Extract Windows JRE
- name: Extract JRE into Java
run: 7z x java.zip -o./connector/commvault-dist/
# Prepare the Windows distribution folder for Zip
- name: Create Windows Folder
run: |
mkdir CommVault_Windows
mkdir CommVault_Windows/emplugins
mkdir CommVault_Windows/xmlbackupdefinitions/
mv connector/commvault-dist/jdk-* CommVault_Windows/java
cp connector/commvault-dist/CVault.exe CommVault_Windows/
cp connector/commvault-dist/Encrypt.exe CommVault_Windows/
cp connector/commvault-dist/Connector.config CommVault_Windows/
cp connector/commvault-dist/com.sma.ui.core.jobdetails.commvault_1.0.0.202005140857.jar CommVault_Windows/emplugins
cp connector/commvault-dist/file_system.xml CommVault_Windows/xmlbackupdefinitions/
cp connector/commvault-dist/script_incr.xml CommVault_Windows/xmlbackupdefinitions/
cp connector/commvault-dist/script_synthetic_full.xml CommVault_Windows/xmlbackupdefinitions/
cp docs/commvault.md CommVault_Windows/
# Zip the folder that contains all binaries and configuration to run on Windows (including Java)
- name: Zip Windows Folder
uses: montudor/action-zip@v0.1.0
with:
args: zip -qq -r ./CommVault_Windows.zip ./CommVault_Windows
# Upload the CVault.exe binary file as artifact
- uses: actions/upload-artifact@v1
with:
name: CVault.exe
path: connector/commvault-dist/CVault.exe
# Upload the ecryptvalue.exe binary file as artifact
- uses: actions/upload-artifact@v1
with:
name: Encrypt.exe
path: connector/commvault-dist/Encrypt.exe
# Upload the job sub-type binary file as artifact
- uses: actions/upload-artifact@v1
with:
name: com.sma.ui.core.jobdetails.commvault_1.0.0.202005140857.jar
path: connector/commvault-dist/com.sma.ui.core.jobdetails.commvault_1.0.0.202005140857.jar
# Upload the CommVault_Windows.zip file as artifact
- uses: actions/upload-artifact@v1
with:
name: CommVault_Windows.zip
path: ./CommVault_Windows.zip
#########################
# RELEASE | TAG CREATED #
#########################
Job_Release:
# Release - only ran when pushing new Tag starting with 'v'
if: startsWith(github.ref, 'refs/tags/v')
name: Release
needs: job_Package
runs-on: ubuntu-latest
steps:
- name: Download Windows Package
uses: actions/download-artifact@v1
with:
name: CommVault_Windows.zip
path: ./
- name: Download job subtype
uses: actions/download-artifact@v1
with:
name: com.sma.ui.core.jobdetails.commvault_1.0.0.202005140857.jar
path: ./
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
# Upload the Windows Zip distribution to the newly created Release
- name: Upload Windows Release Asset
id: upload_release_asset_win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: CommVault_Windows.zip
asset_name: CommVault_Windows.zip
asset_content_type: application/zip
# Upload the Job Subtype the newly created Release
- name: Upload JobSubtype Asset
id: upload_release_asset_subtype
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: com.sma.ui.core.jobdetails.commvault_1.0.0.202005140857.jar
asset_name: com.sma.ui.core.jobdetails.commvault_1.0.0.202005140857.jar
asset_content_type: application/zip