-
Notifications
You must be signed in to change notification settings - Fork 22
166 lines (151 loc) · 5.89 KB
/
publish-packages.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
name: Publish Hazelcast OS & EE packages
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
types: [ opened, synchronize, edited ]
workflow_dispatch:
inputs:
HZ_VERSION:
description: 'Version of Hazelcast to build the packages from, this is the Maven version - e.g.: 5.0.2 or 5.1-SNAPSHOT'
required: true
PACKAGE_TYPES:
description: 'Packages to build'
required: true
default: 'all'
type: choice
options:
- all
- deb
- rpm
- homebrew
RELEASE_TYPE:
description: 'Which editions should be built'
required: true
default: 'EE'
type: choice
options:
- ALL
- OSS
- EE
env:
EVENT_NAME: ${{ github.event_name }}
RELEASE_TYPE_FILE: .github/release_type
concurrency:
group: '${{ github.workflow }}-${{ github.base_ref || github.ref_name}}'
jobs:
prepare:
runs-on: ubuntu-latest
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE || 'EE' }}
PACKAGE_TYPES: ${{ inputs.PACKAGE_TYPES || 'all' }}
HZ_VERSION: ${{ github.event.inputs.HZ_VERSION }}
outputs:
hz_version: ${{ steps.hz_version_step.outputs.hz_version }}
should_build_oss: ${{ steps.which_editions.outputs.should_build_oss }}
should_build_ee: ${{ steps.which_editions.outputs.should_build_ee }}
should_build_deb: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'deb' }}
should_build_rpm: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'rpm' }}
should_build_homebrew: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'homebrew' }}
use_test_repo: ${{ env.EVENT_NAME == 'pull_request' }}
steps:
- name: Checkout hazelcast-packaging repo
uses: actions/checkout@v4
- name: Load env vars from .env file
run: cat .env >> $GITHUB_ENV
- name: Test scripts
run: |
./test_scripts.sh
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Set HZ_VERSION
id: hz_version_step
run: |
if [ -z "${{ env.HZ_VERSION }}" ]; then
HZ_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
fi
echo "hz_version=$HZ_VERSION" >> $GITHUB_OUTPUT
- name: Forbid ${{ env.RELEASE_TYPE_FILE }} file in the PRs
if: github.event_name == 'pull_request'
run: |
if [ -f "${{ env.RELEASE_TYPE_FILE }}" ]; then
echo "Error: ${{ env.RELEASE_TYPE_FILE }} file is not allowed in the PRs. It's used only during release creation"
exit 1
fi
- name: Read release type from the file
run: |
if [ -f ${{ env.RELEASE_TYPE_FILE }} ]; then
echo "RELEASE_TYPE=$(cat ${{ env.RELEASE_TYPE_FILE }})" >> $GITHUB_ENV
else
echo "File '${{ env.RELEASE_TYPE_FILE }}' does not exist."
fi
- name: Check which editions should be built
id: which_editions
run: |
. .github/workflows/build.functions.sh
release_type=${{ env.RELEASE_TYPE }}
triggered_by=${{ github.event_name }}
should_build_oss=$(should_build_oss "$triggered_by" "$release_type")
should_build_ee=$(should_build_ee "$triggered_by" "$release_type")
echo "should_build_ee=${should_build_ee}" >> $GITHUB_OUTPUT
echo "should_build_oss=${should_build_oss}" >> $GITHUB_OUTPUT
deb-ee:
if: needs.prepare.outputs.should_build_deb == 'true' && needs.prepare.outputs.should_build_ee == 'yes'
needs: [prepare]
uses: ./.github/workflows/publish-deb-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
deb-oss:
needs: [ prepare ]
if: needs.prepare.outputs.should_build_deb == 'true' && needs.prepare.outputs.should_build_oss == 'yes'
uses: ./.github/workflows/publish-deb-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
rpm-ee:
if: needs.prepare.outputs.should_build_rpm == 'true' && needs.prepare.outputs.should_build_ee == 'yes'
needs: [prepare]
uses: ./.github/workflows/publish-rpm-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
rpm-oss:
needs: [ prepare ]
if: needs.prepare.outputs.should_build_rpm == 'true' && needs.prepare.outputs.should_build_oss == 'yes'
uses: ./.github/workflows/publish-rpm-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
brew-ee:
if: needs.prepare.outputs.should_build_homebrew == 'true' && needs.prepare.outputs.should_build_ee == 'yes'
needs: [prepare]
uses: ./.github/workflows/publish-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
brew-oss:
needs: [ prepare ]
if: needs.prepare.outputs.should_build_homebrew == 'true' && needs.prepare.outputs.should_build_oss == 'yes' && !contains(needs.prepare.outputs.hz_version, 'SNAPSHOT')
uses: ./.github/workflows/publish-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}