-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (89 loc) · 3.29 KB
/
publish.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
name: Publish
on: [ push ]
jobs:
infer-version:
name: Computing a new version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.nyx-infer.outputs.version }}
newRelease: ${{ steps.nyx-infer.outputs.newRelease }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run nyx Infer
id: nyx-infer
uses: mooltiverse/nyx-github-action@main
with:
command: 'infer'
configurationFile: '.nyx.json'
resume: 'true'
- name: Run nyx Make
uses: mooltiverse/nyx-github-action@main
with:
command: 'make'
configurationFile: '.nyx.json'
resume: 'true'
publish-version:
if: needs.infer-version.outputs.newRelease == 'true'
name: Publishing a new version
runs-on: ubuntu-latest
needs: infer-version
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: adopt
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Change wrapper permissions
run: chmod +x gradlew
# - name: Run gradle publish
# run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache
# env:
# ORG_GRADLE_PROJECT_projectVersion: ${{ needs.infer-version.outputs.version }}
# ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
# ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
# ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
# ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
- name: Nyx publish
uses: mooltiverse/nyx-github-action@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NYX_RELEASE_TYPES_PUBLICATION_SERVICES: 'GITHUB'
NYX_SERVICES_GITHUB_NAME: 'GITHUB'
NYX_SERVICES_GITHUB_TYPE: 'GITHUB'
NYX_SERVICES_GITHUB_OPTIONS_AUTHENTICATION_TOKEN: "{{#environmentVariable}}GH_TOKEN{{/environmentVariable}}"
NYX_SERVICES_GITHUB_OPTIONS_REPOSITORY_NAME: 'webmonitor'
NYX_SERVICES_GITHUB_OPTIONS_REPOSITORY_OWNER: 'ennioVisco'
with:
command: 'publish'
configurationFile: '.nyx.json'
resume: 'true'
update-readme:
if: github.ref_name == 'master'
name: Updating README.md
runs-on: ubuntu-latest
needs: [ publish-version, infer-version ]
steps:
- uses: actions/checkout@v4
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
find: com.enniovisco:webmonitor:\d+.\d+.\d+(-SNAPSHOT)?
replace: com.enniovisco:webmonitor:${{ needs.infer-version.outputs.version }}
include: "README.md"
- uses: fregante/setup-git-user@v2
- name: Push changes
run: |
git add README.md
git commit -m "Updated README.md instructions with new package version" || true
git push || true