File tree 4 files changed +39
-20
lines changed
4 files changed +39
-20
lines changed Original file line number Diff line number Diff line change 1
1
name : ' Check for new API spec version'
2
2
3
3
on :
4
- workflow_dispatch :
5
4
schedule :
6
5
- cron : ' 0 6 * * 1'
6
+ workflow_dispatch :
7
+ inputs :
8
+ dry_run :
9
+ description : ' Dry run'
10
+ type : boolean
11
+ required : false
12
+ workflow_call :
7
13
8
14
defaults :
9
15
run :
10
16
shell : bash
11
17
18
+ env :
19
+ DRY_RUN : ${{ github.event.inputs.dry_run || github.event_name == 'pull_request' }}
20
+
12
21
jobs :
13
22
14
23
check-new-api-spec :
24
33
[[ -n "$version" ]]
25
34
echo "SPEC_VERSION=$version" | tee -a "$GITHUB_ENV"
26
35
- name : ' Create PR'
36
+ if : ${{ env.DRY_RUN == 'false' }}
27
37
uses : peter-evans/create-pull-request@v4
28
38
with :
29
39
branch : " feature/api-spec-${{ env.SPEC_VERSION }}"
Original file line number Diff line number Diff line change 44
44
- name : ' unittest discover'
45
45
if : ${{ steps.diff.outputs.all_modified_files }}
46
46
run : python3 -m unittest discover -bs .github/scripts
47
+
48
+ publish-javadoc-dry-run :
49
+ uses : ./.github/workflows/publish-javadoc.yml
50
+
51
+ check-new-api-spec-dry-run :
52
+ uses : ./.github/workflows/check-new-api-spec.yml
Original file line number Diff line number Diff line change 5
5
tags : ['*']
6
6
workflow_dispatch :
7
7
inputs :
8
- version_name :
9
- description : ' Version'
10
- required : true
8
+ dry_run :
9
+ description : ' Dry run'
10
+ type : boolean
11
+ required : false
12
+ workflow_call :
11
13
12
14
defaults :
13
15
run :
14
16
shell : bash
15
17
16
18
env :
17
- VERSION_NAME : ${{ github.event.inputs.version_name || github.ref_name }}
19
+ DRY_RUN : ${{ github.event.inputs.dry_run || github.event_name == 'pull_request' }}
20
+ JAR_NAME : gradle-enterprise-api-kotlin-SNAPSHOT-javadoc.jar
18
21
19
22
jobs :
20
23
21
24
build-javadoc :
22
25
runs-on : ubuntu-latest
23
- outputs :
24
- version : ${{ env.VERSION }}
25
26
steps :
26
27
- name : Checkout
27
28
uses : actions/checkout@v3
28
- with :
29
- ref : ${{ env.VERSION_NAME }}
30
29
- name : Build javadoc
31
30
uses : ./.github/actions/build
32
31
with :
33
32
tasks : ' javadocJar'
34
33
artifact-name : ' javadoc'
35
- path-to-upload : " build/libs/gradle-enterprise-api-kotlin- ${{ env.VERSION_NAME }}-javadoc.jar "
34
+ path-to-upload : " build/libs/${{ env.JAR_NAME }}"
36
35
37
- commit-to-gh-pages :
36
+ publish-javadoc :
38
37
needs : [build-javadoc]
39
38
runs-on : ubuntu-latest
40
39
steps :
41
40
- name : Checkout
42
41
uses : actions/checkout@v3
43
- with :
44
- ref : ${{ env.VERSION_NAME }}
42
+ - name : Fetch branch
43
+ run : git fetch origin gh-pages && git checkout FETCH_HEAD
45
44
- name : Download javadoc
46
45
uses : actions/download-artifact@v3
47
- - name : Commit and push
46
+ - name : Unzip javadoc
47
+ run : rm -rf docs && unzip "javadoc/$JAR_NAME" -d docs
48
+ - name : Commit
48
49
run : |
49
50
git config user.name github-actions
50
51
git config user.email github-actions@github.com
51
- git checkout gh-pages
52
- rm -rf docs
53
- unzip "gradle-enterprise-api-kotlin-$VERSION_NAME-javadoc.jar" -d docs
54
52
git add docs
55
- git commit -m "Add $VERSION_NAME javadoc"
56
- git push
53
+ git commit -m "Add ${{ github.ref_name }} javadoc"
54
+ - name : Push
55
+ run : |
56
+ if [[ "$DRY_RUN" == 'true' ]]; then
57
+ args=' --dry-run'
58
+ fi
59
+ git push origin HEAD:gh-pages $args
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ plugins {
11
11
}
12
12
13
13
group = " com.github.gabrielfeo"
14
- version = " 0.10.0 "
14
+ version = " SNAPSHOT "
15
15
val repoUrl = " https://github.com/gabrielfeo/gradle-enterprise-api-kotlin"
16
16
17
17
val downloadApiSpec by tasks.registering {
You can’t perform that action at this time.
0 commit comments