-
Notifications
You must be signed in to change notification settings - Fork 4
123 lines (104 loc) · 3.49 KB
/
cd-config.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
name: Solid Java Client CD
on:
push:
branches:
- 1.0
tags:
- inrupt-client-1.0.[0-9]+
jobs:
deployment:
name: Deploy artifacts
runs-on: ubuntu-latest
permissions:
deployments: write
strategy:
matrix:
envName: ["Development", "Production"]
release:
- ${{ contains(github.ref, 'inrupt-client-') }}
exclude:
- release: false
envName: "Production"
- release: true
envName: "Development"
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
cache: 'maven'
server-id: 'ossrh'
server-username: MAVEN_REPO_USERNAME
server-password: MAVEN_REPO_TOKEN
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Create GitHub deployment
uses: chrnorm/deployment-action@v2
id: deployment
with:
token: ${{ github.token }}
environment: ${{ matrix.envName }}
- name: Build the code with Maven
run: mvn -B -ntp install -Pci
- name: Deploy Artifacts
if: ${{ github.actor != 'dependabot[bot]' }}
run: mvn deploy -P publish
env:
MAVEN_REPO_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_REPO_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
state: 'success'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
state: 'failure'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Sonar Analysis
if: ${{ github.actor != 'dependabot[bot]' }}
run: mvn sonar:sonar -Dsonar.login=${{ secrets.SONARQUBE_TOKEN }}
site:
name: Publish version-specific site
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
environment:
name: "Documentation"
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
cache: 'maven'
- name: Build the code with Maven
run: mvn -B -ntp install -Pwebsite
- name: Build the site with Maven
run: mvn -B -ntp site site:stage -Pwebsite
- name: Set site version
run: |
VERSION=$(mvn -q help:evaluate -Dexpression=project.version -DforceStdout)
echo "VERSION_DIR=./${VERSION}/" >> $GITHUB_ENV
- name: Publish tagged site to GitHub pages
uses: peaceiris/actions-gh-pages@v4
if: ${{ startsWith(github.event.ref, 'refs/tags/inrupt-client') }}
with:
keep_files: true
publish_dir: ./target/staging/
personal_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish versioned site to GitHub pages
uses: peaceiris/actions-gh-pages@v4
with:
keep_files: true
publish_dir: ./target/staging/
destination_dir: ${{ env.VERSION_DIR }}
personal_token: ${{ secrets.GITHUB_TOKEN }}