forked from fasten-project/data-processing
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (87 loc) · 3.65 KB
/
deploy.yml
File metadata and controls
100 lines (87 loc) · 3.65 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
name: Deploy
on:
push:
tags: ["release"]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of distributionManagement/repository/id
settings-path: ${{ github.workspace }} # location of settings.xml
- name: Configure git
run: |
git config --global committer.email "noreply@github.com"
git config --global committer.name "GitHub"
git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global author.name "Build Server"
- name: Parse and provide version info
run: |
cd releng
VERSION_RAW=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
VERSION=`echo $VERSION_RAW | cut -d"-" -f1` # get rid of -SNAPSHOT
MAJOR=`echo "$VERSION" | cut -d . -f 1`
MINOR=`echo "$VERSION" | cut -d . -f 2`
PATCH=`echo "$VERSION" | cut -d . -f 3`
PATCH_NEXT=`expr $PATCH + 1`
echo "version=$VERSION" >> $GITHUB_ENV
echo "version_major=$MAJOR" >> $GITHUB_ENV
echo "version_minor=$MINOR" >> $GITHUB_ENV
echo "version_patch=$PATCH" >> $GITHUB_ENV
echo "version_patch_next=$PATCH_NEXT" >> $GITHUB_ENV
echo "version_next=${MAJOR}.${MINOR}.${PATCH_NEXT}-SNAPSHOT" >> $GITHUB_ENV
- name: Update all projects to release version
run: |
cd releng
mvn -B -ntp versions:set -DnewVersion=${{ env.version }}
- name: Update version.txt in infrastructure-impl to release version
run: |
cd infrastructure/infrastructure-impl
echo "${{ env.version }}" > src/main/resources/version.txt
../../releng/set_VersionImplTest_constant.sh ${{ env.version }}
- name: Build and deploy Maven packages
run: |
cd releng
mvn -B -ntp clean deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Commit and tag the release version
run: |
rm settings.xml
git add .
git commit -m "Release of version ${{ env.version }}"
git push origin HEAD:main
git tag "v${{ env.version }}"
git push origin "v${{ env.version }}"
- name: Build Docker image and push to ghcr.io
run: |
cd infrastructure/loader
echo "${{ github.token }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Multiple .jar files in the folder will break Dockerfile
rm target/*-sources.jar
IMG=ghcr.io/${{ github.repository }}
docker build \
--tag $IMG:${{ env.version }} \
--tag $IMG:${{ env.version_major }}.${{ env.version_minor }}.latest \
--tag $IMG:${{ env.version_major }}.latest \
--tag $IMG:latest \
.
docker push --all-tags $IMG
- name: Update all projects to next snapshot release
run: |
cd releng
mvn -B -ntp versions:set -DnewVersion=${{ env.version_next }}
- name: Update version.txt in infrastructure-impl to next snapshot release
run: |
cd infrastructure/infrastructure-impl
echo "${{ env.version_next }}" > src/main/resources/version.txt
../../releng/set_VersionImplTest_constant.sh ${{ env.version_next }}
- name: Commit the next snapshot release
run: |
git add .
git commit -m "Bump version to ${{ env.version_next }}"
git push origin HEAD:main