-
Notifications
You must be signed in to change notification settings - Fork 7
137 lines (120 loc) · 4.94 KB
/
ci-master.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
# Main build pipeline, operates on `master` branch which is our integration branch and creates release
name: CI Master branch
on:
push:
branches:
- "master" # trap each push to master branch
- "release_*" # trap each push to branches starting with release_
paths: # but react only to changes in code or pipeline definition
- evita*/**/*.java
- evita*/**/pom.xml
- jacoco/**/pom.xml
- evita*/**/dist/**.*
- docker/**
- .github/**
concurrency:
group: ${{ github.ref_name }} # for the same branch
cancel-in-progress: true # run only one workflow at a time (cancel the previous)
jobs:
build:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
outputs:
release_id: ${{ steps.create_release.outputs.id }}
released_version: ${{ steps.release_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 # checkout sources
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Resolve new release version
id: release_version
uses: lukashornych/semantic-calendar-version@0f83ab20d3764a08d5746e6501f96c76f0a2d513 #v1.1.3
with:
prefix: 'v'
year_switch_mode: 'OnMinor'
minor-identifier: '/feat(?:\\([^)]+\\))?:/'
- name: Setup Java JDK
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 setup JDK 17 for building
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build with Maven # run Maven without tests (tests must pass in dev branch)
run: |
export SANITIZED_VERSION=$(echo "$EVITA_BUILD_VERSION" | tr -d '\r\n')
export NEW_VERSION="$( echo "${SANITIZED_VERSION}" | sed 's/^v//; s/-.*//')"
echo $NEW_VERSION > version.txt
echo "Version: $(cat version.txt)"
mvn versions:set -DnewVersion=$NEW_VERSION
mvn -T 1C -B -P release-sign-artifacts -Dmaven.test.skip=true deploy --file pom.xml
env:
EVITA_BUILD_VERSION: ${{ steps.release_version.outputs.version }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Create distribution directory
run: |
mkdir -p ./dist
cp LICENSE ./dist
cp 'evita_server/target/evita-server.jar' ./dist
cp 'evita_server/dist/run.sh' './dist'
cp 'evita_server/dist/logback.xml' './dist'
- name: Create .zip of dist
uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6
with:
type: 'zip'
filename: 'dist.zip'
path: './dist'
- name: Create .tar.gz of dist
uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6
with:
type: 'tar'
filename: 'dist.tar.gz'
path: './dist'
- name: Create release
id: create_release
uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
with:
version: ${{ steps.release_version.outputs.version }}
publish: true
- name: Upload dist.zip to release
uses: actions/upload-release-asset@64e5e85fc528f162d7ba7ce2d15a3bb67efb3d80 # v1.0.1
if: success()
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist.zip
asset_name: Dist (zip)
asset_content_type: application/zip
- name: Upload dist.tar.gz to release
uses: actions/upload-release-asset@64e5e85fc528f162d7ba7ce2d15a3bb67efb3d80 # v1.0.1
if: success()
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist.tar.gz
asset_name: Dist (tar.gz)
asset_content_type: application/gzip
- name: Upload evitaDB server artifact # upload `evita-server.jar` for `docker-latest.yml` to deploy to DockerHub
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: success()
with:
name: evita-server.jar
path: 'evita_server/target/evita-server.jar'
- name: Upload evitaDB version.txt # upload `version.txt` for `docker-latest.yml` to deploy to DockerHub
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: success()
with:
name: version.txt
path: 'version.txt'