Repository navigation
137 lines (122 loc) · 4.37 KB
/
Copy pathrelease.yaml
File metadata and controls
137 lines (122 loc) · 4.37 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
name: Release
on:
# enable running the workflow manually
workflow_dispatch:
inputs:
revision:
type: string
description: 'Release version'
default: '0-SNAPSHOT'
override_tag:
type: boolean
description: 'If to move the tag if already exists'
default: false
required: false
dry_run:
type: boolean
description: 'If to skip publishing the release to central repository'
default: false
required: false
permissions:
contents: write
security-events: write
jobs:
audit:
# only on original eclipse-hawkbit/hawkbit repo
if: github.repository == 'eclipse-hawkbit/hawkbit'
runs-on: ubuntu-latest
steps:
# inputs are passed via env (not ${{ }} in run:) so they can't inject shell code; the format check stops
# a malformed revision before tag / deploy, which depend on this job
- name: "Release ${{ inputs.revision }}"
env:
REVISION: ${{ inputs.revision }}
run: |
[[ "$REVISION" =~ ^[0-9A-Za-z._-]+$ ]] || { echo "invalid revision: $REVISION"; exit 1; }
echo "Releasing $REVISION"
# tag with release version if not already tagged
# if already tagged - it will release from there
tag:
# only on original eclipse-hawkbit/hawkbit repo and when release fixed version
if: github.repository == 'eclipse-hawkbit/hawkbit' && inputs.revision != '0-SNAPSHOT'
needs: audit
uses: ./.github/workflows/reusable_workflow_tag.yaml
permissions:
contents: write
with:
tag_name: ${{ inputs.revision }}
tag_message: "Release version ${{ inputs.revision }}"
override_tag: ${{ inputs.override_tag }}
license-scan:
# only on original eclipse-hawkbit/hawkbit repo
if: github.repository == 'eclipse-hawkbit/hawkbit'
needs: tag
uses: ./.github/workflows/reusable_workflow_license-scan.yaml
permissions:
contents: write
with:
ref: ${{ inputs.revision == '0-SNAPSHOT' && github.ref || inputs.revision }}
trivy-scan:
# only on original eclipse-hawkbit/hawkbit repo or when manually triggered
if: github.repository == 'eclipse-hawkbit/hawkbit'
needs: tag
uses: ./.github/workflows/reusable_workflow_trivy-scan.yaml
permissions:
contents: read
security-events: write
with:
ref: ${{ inputs.revision == '0-SNAPSHOT' && github.ref || inputs.revision }}
upload: true
deploy:
# only on original eclipse-hawkbit/hawkbit repo
if: github.repository == 'eclipse-hawkbit/hawkbit'
needs:
- license-scan
- trivy-scan
runs-on: ubuntu-latest
permissions:
contents: write
services:
rabbitmq:
image: rabbitmq:3-management-alpine
env:
RABBITMQ_DEFAULT_VHOST: /
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 15672:15672
- 5672:5672
steps:
- uses: actions/checkout@v7.0.1
with:
ref: ${{ inputs.revision == '0-SNAPSHOT' && github.ref || inputs.revision }}
- name: Set up JDK & Maven Central credentials
uses: actions/setup-java@v6.1.0
with:
distribution: 'temurin'
java-version: '25'
cache: 'maven'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Cache local Maven repository
uses: actions/cache@v6.1.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run build javadoc, verify (test)
env:
REVISION: ${{ inputs.revision }}
run: mvn verify javadoc:jar -DdetectOfflineLinks=false -PgenerateTestReport "-Drevision=$REVISION" --batch-mode
- name: "Deploy ${{ inputs.revision }}"
env:
REVISION: ${{ inputs.revision }}
DRY_RUN: ${{ inputs.dry_run }}
MAVEN_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn deploy -DskipTests -Ppublish "-Drevision=$REVISION" "-DskipPublishing=$DRY_RUN" --batch-mode