-
-
Notifications
You must be signed in to change notification settings - Fork 82
90 lines (76 loc) · 3.24 KB
/
publish.yaml
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
name: Publish New Version
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
default: "2."
jobs:
publish:
name: Publish tinylog ${{github.event.inputs.version}}
runs-on: ubuntu-20.04
steps:
- name: Configure GIT
run: |
git config --global user.name "${{github.actor}}"
git config --global user.email "${{github.actor}}@users.noreply.github.com"
- name: Check out tinylog repository
uses: actions/checkout@v4
- name: Set up JDK 9
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 9
- name: Store original version
run: |
echo "ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Create version ${{github.event.inputs.version}}
run: |
mvn -DnewVersion=${{github.event.inputs.version}} -DgenerateBackupPoms=false --no-transfer-progress --batch-mode versions:set
git commit -am "Release version ${{github.event.inputs.version}}"
git tag "${{github.event.inputs.version}}"
- name: Deploy version ${{github.event.inputs.version}}
uses: samuelmeuli/action-maven-publish@v1
with:
maven_profiles: release
maven_args: "--no-transfer-progress --batch-mode"
gpg_private_key: ${{secrets.OSSRH_GPG_SECRET_KEY}}
gpg_passphrase: ${{secrets.OSSRH_GPG_PASSWORD}}
nexus_username: pmw
nexus_password: ${{secrets.OSSRH_SERVER_PASSWORD}}
- name: Create P2 repository
run: |
mvn -P release --no-transfer-progress --batch-mode --non-recursive p2:site
- name: Upload P2 repository
uses: kevinpainchaud/[email protected]
with:
ftp_host: tinylog.org
ftp_username: [email protected]
ftp_password: ${{secrets.FTP_PASSWORD_TINYLOG2_P2_REPOSITORY}}
local_source_dir: "target/repository"
dist_target_dir: ${{github.event.inputs.version}}
- name: Create release draft
uses: ncipollo/release-action@v1
with:
name: "Version ${{github.event.inputs.version}}"
tag: "${{github.event.inputs.version}}"
artifacts: "target/*"
prerelease: ${{contains(github.event.inputs.version, '-')}}
draft: true
token: ${{secrets.GITHUB_TOKEN}}
- name: Store file size
run: |
FILE_PATH_API=tinylog-api/target/tinylog-api-${{github.event.inputs.version}}.jar
FILE_SIZE_API=$(stat -c%s "$FILE_PATH_API")
FILE_PATH_IMPL=tinylog-impl/target/tinylog-impl-${{github.event.inputs.version}}.jar
FILE_SIZE_IMPL=$(stat -c%s "$FILE_PATH_IMPL")
echo "FILE_SIZE=$((FILE_SIZE_API + FILE_SIZE_IMPL))" >> $GITHUB_ENV
- name: Restore original version
run: |
mvn -DnewVersion=${ORIGINAL_VERSION} -DgenerateBackupPoms=false --no-transfer-progress --batch-mode versions:set
git commit -am "Restore snapshot version ${ORIGINAL_VERSION}"
- name: Push changes to tinylog repository
run: |
git push origin
git push origin "${{github.event.inputs.version}}"