-
Notifications
You must be signed in to change notification settings - Fork 3
156 lines (125 loc) · 4.64 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Publish Artifacts
on:
push:
tags:
- '**'
env:
OSS_USER: '${{ secrets.OSS_USER }}'
OSS_TOKEN: '${{ secrets.OSS_TOKEN }}'
OSS_STAGING_PROFILE_ID: '${{ secrets.OSS_STAGING_PROFILE_ID }}'
SIGNING_KEY_NAME: '${{ secrets.SIGNING_KEY_NAME }}'
SIGNING_KEY_ID: '${{ secrets.SIGNING_KEY_ID }}'
SIGNING_KEY_PASSPHRASE: '${{ secrets.SIGNING_KEY_PASSPHRASE }}'
SIGNING_KEY: '${{ secrets.SIGNING_KEY }}'
GRADLE_PUBLISH_KEY: '${{ secrets.GRADLE_PUBLISH_KEY }}'
GRADLE_PUBLISH_SECRET: '${{ secrets.GRADLE_PUBLISH_SECRET }}'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
outputs:
analysis-version: ${{ steps.get-analysis-version.outputs.analysis-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build and test with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build --scan --stacktrace
- id: get-analysis-version
name: Get Analysis version
run: |
./gradlew
echo "::set-output name=analysis-version::$(head -n 1 build/semver/version.txt)"
- name: Upload reports
uses: actions/upload-artifact@v3
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'
- name: Stop Gradle daemons
run: ./gradlew --stop
# - name: Bundle SARIF report
# run: mkdir sarif && find . -name '*.sarif' | xargs -I{} cp "{}" ./sarif/
#
# - name: Upload SARIF report
# uses: github/codeql-action/[email protected]
# continue-on-error: true
# with:
# # Path to SARIF file relative to the root of the repository
# sarif_file: sarif
#
publish:
needs: build
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Publish alpha/beta/rc artifacts
if: |
contains(needs.build.outputs.analysis-version, 'alpha') ||
contains(needs.build.outputs.analysis-version, 'beta') ||
contains(needs.build.outputs.analysis-version, 'rc')
run: ./gradlew --full-stacktrace publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Publish final artifacts
if: |
!contains(needs.build.outputs.analysis-version, 'alpha') &&
!contains(needs.build.outputs.analysis-version, 'beta') &&
!contains(needs.build.outputs.analysis-version, 'rc')
run: ./gradlew --full-stacktrace publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Publish alpha/beta/rc gradle plugins
if: |
contains(needs.build.outputs.analysis-version, 'alpha') ||
contains(needs.build.outputs.analysis-version, 'beta') ||
contains(needs.build.outputs.analysis-version, 'rc')
run: ./gradlew --full-stacktrace publishPlugins
- name: Publish final gradle plugins
if: |
!contains(needs.build.outputs.analysis-version, 'alpha') &&
!contains(needs.build.outputs.analysis-version, 'beta') &&
!contains(needs.build.outputs.analysis-version, 'rc')
run: ./gradlew --full-stacktrace publishPlugins
- name: Stop Gradle daemons
run: ./gradlew --stop
publish_documentation:
needs: build
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_CLOUDFRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
AWS_DEFAULT_REGION: eu-west-1
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
JEKYLL_ENV: production
S3_BUCKET: ${{ secrets.S3_BUCKET }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Prepare environment
run: |
sudo gem install bundler
bundle config set --local path 'vendor/bundle'
bundle install --gemfile docs/Gemfile
- name: Create API Doc and validate
run: ./gradlew buildDoc
- name: Generate site
run: bundle exec jekyll build -b docs/analysis -s docs/docs -d docs/build/_site
- name: Upload site to S3 bucket
run: aws s3 sync --delete docs/build/_site s3://$S3_BUCKET/docs/analysis
- name: Invalidate CloudFront cache
run: aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_ID --paths "/docs/analysis"
- name: Stop Gradle daemons
run: ./gradlew --stop