-
Notifications
You must be signed in to change notification settings - Fork 7
93 lines (77 loc) · 2.3 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
name: Publish Task
on:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: "${{ github.workflow }}"
cancel-in-progress: false
env:
# https://stackoverflow.com/a/71158878/4161471
GIT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
create-m2-publication:
runs-on: ubuntu-latest
environment:
name: artifacts
url: ${{ steps.deployment.outputs.page_url }}
timeout-minutes: 60
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
ref: ${{ env.GIT_BRANCH_NAME }}
- name: setup JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Run publish task
run: >-
./gradlew publishAllPublicationsToGitHubPublishRepository --stacktrace --info
env:
GITHUB_PUBLISH_DIR: ${{ runner.temp }}/m2
- name: upload build reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: build-report-${{ runner.os }}-${{ github.action }}
path: "**/build/reports/"
if-no-files-found: ignore
- name: upload local project publication
uses: actions/upload-artifact@v3
with:
name: m2-publication
path: ${{ env.GITHUB_PUBLISH_DIR }}
env:
GITHUB_PUBLISH_DIR: ${{ runner.temp }}/m2
commit-artifacts:
runs-on: ubuntu-latest
needs: create-m2-publication
environment:
name: artifacts
url: https://github.com/adamko-dev/dokkatoo/tree/artifacts/m2
env:
CI_COMMIT_MESSAGE: artifacts
CI_COMMIT_AUTHOR: ${{ github.workflow }}
steps:
- name: Checkout artifacts branch
uses: actions/checkout@v3
with:
ref: artifacts
- name: download local project publication
uses: actions/download-artifact@v3
with:
name: m2-publication
path: m2
- name: git push
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git add .
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push