-
Notifications
You must be signed in to change notification settings - Fork 9
143 lines (128 loc) · 5.22 KB
/
build-and-release.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
138
139
140
141
142
143
name: CI/CD
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: devonfw-actions/java-maven-setup@v5
with:
maven-cache-key: dep-${{ hashFiles('**/pom.xml') }}
- name: Build & Test
run: mvn install
release:
needs: [build]
runs-on: ubuntu-latest
if: ${{ startsWith(github.repository, 'devonfw/') && github.ref == 'refs/heads/master' }}
continue-on-error: true
environment:
name: maven-central
outputs:
release_tag: ${{ steps.get_tag.outputs.tag }}
steps:
- uses: devonfw-actions/java-maven-setup@v5
with:
maven-cache-key: dep-${{ hashFiles('**/pom.xml') }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
BUILD_USER: ${{ secrets.BUILD_USER }}
BUILD_USER_PASSWD: ${{ secrets.BUILD_USER_PASSWD }}
BUILD_USER_EMAIL: ${{ secrets.BUILD_USER_EMAIL }}
- name: Release
id: release
shell: bash
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
BUILD_USER: ${{ secrets.BUILD_USER }}
BUILD_USER_PASSWD: ${{ secrets.BUILD_USER_PASSWD }}
BUILD_USER_EMAIL: ${{ secrets.BUILD_USER_EMAIL }}
run: ./release.sh silent repo-mvn-settings
- name: 'Get release tag'
id: get_tag
uses: "WyriHaximus/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GHA_TOKEN }}"
github-release:
needs: release
runs-on: ubuntu-latest
if: ${{ startsWith(github.repository, 'devonfw/') && github.ref == 'refs/heads/master' && startsWith(needs.release.outputs.release_tag, 'release') }}
steps:
- uses: devonfw-actions/create-github-release@v2
with:
release_version: ${{ needs.release.outputs.release_tag }}
GHA_TOKEN: ${{ secrets.GHA_TOKEN }}
apply-to-website:
needs: release
runs-on: ubuntu-latest
environment:
name: devonfw.com
if: ${{ startsWith(github.repository, 'devonfw/') && github.ref == 'refs/heads/master' && startsWith(needs.release.outputs.release_tag, 'release') }}
steps:
- name: Clone Repository
uses: devonfw-actions/java-maven-setup@v7
with:
repository: 'devonfw/devonfw.github.io'
GIT_TOKEN: ${{ secrets.GHA_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
BUILD_USER: ${{ secrets.BUILD_USER }}
BUILD_USER_PASSWD: ${{ secrets.BUILD_USER_PASSWD }}
BUILD_USER_EMAIL: ${{ secrets.BUILD_USER_EMAIL }}
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.34'
- name: Apply new version to devonfw.com
run: |
set -e
find . -type f -name 'pom.xml' | xargs perl -0777 -pi -e 's|(<groupId>com.devonfw.tools</groupId>\s*<artifactId>devonfw-docgen[^<]*</artifactId>\s*<version>)[^<]+(</version>)|${1}${{ needs.release.outputs.release_tag }}$2|g'
git add -u
git commit -m"Update docgen to latest version"
git push
- name: Dispatch Website Repository
uses: guilouro/[email protected]
with:
repo_token: ${{ secrets.GHA_TOKEN }}
event_type: dispatch-build-website
repositories: |
devonfw/devonfw.github.io
apply-to-guide:
needs: release
runs-on: ubuntu-latest
environment:
name: devonfw-guide
if: ${{ startsWith(github.repository, 'devonfw/') && github.ref == 'refs/heads/master' && startsWith(needs.release.outputs.release_tag, 'release') }}
steps:
- name: Clone Repository
uses: devonfw-actions/java-maven-setup@v7
with:
repository: 'devonfw/devonfw-guide'
GIT_TOKEN: ${{ secrets.GHA_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
BUILD_USER: ${{ secrets.BUILD_USER }}
BUILD_USER_PASSWD: ${{ secrets.BUILD_USER_PASSWD }}
BUILD_USER_EMAIL: ${{ secrets.BUILD_USER_EMAIL }}
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.34'
- name: Apply new version to devonfw.com
run: |
set -e
find . -type f -name 'pom.xml' | xargs perl -0777 -pi -e 's|(<groupId>com.devonfw.tools</groupId>\s*<artifactId>devonfw-docgen[^<]*</artifactId>\s*<version>)[^<]+(</version>)|${1}${{ needs.release.outputs.release_tag }}$2|g'
git add -u
git commit -m"Update docgen to latest version"
git push
- name: Dispatch Website Repository
uses: guilouro/[email protected]
with:
repo_token: ${{ secrets.GHA_TOKEN }}
event_type: dispatch-build-website
repositories: |
devonfw/devonfw-guide