-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (52 loc) · 2.21 KB
/
report.yaml
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
name: 📊 Generate Report
on:
push:
branches:
- main
workflow_dispatch:
jobs:
create-report:
runs-on: ubuntu-latest
if: "github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, 'release-please--branches--main')"
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v3
- name: Setup JDK 18
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
cache: maven
- name: Setup dependencies
run: |
pip install yq
- name: JSON result to js file
run: |
echo -e "const treasuryCalculationResult = $(cat ./report/treasury_calculation_result.json)" > ./report/treasury_calculation_result.js
- name: 👀 Lookup metadata for report
run: |
echo "VERSION=$(xq -r .project.version pom.xml)" >> $GITHUB_ENV
echo "LATEST_COMMIT_HASH=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_ENV
echo "LATEST_COMMIT_HASH_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
echo "UTC_DATE=$(date -uR|sed 's/.....$//')" >> $GITHUB_ENV
- name: 📂 Create report directory
run: |
mkdir -p report-v${{ env.VERSION }}
- name: 📄 Copy report files
run: |
cp -r report/* report-v${{ env.VERSION }}
- name: 📝 Add metadata to the report
run: |
sed -i 's|<footer></footer>|<footer><p>Created on ${{ env.UTC_DATE }} UTC as a result of modifications triggered by <a href="https://github.com/cardano-foundation/cf-java-rewards-calculation/commit/${{ env.LATEST_COMMIT_HASH }}">${{ env.LATEST_COMMIT_HASH_SHORT }}</a></p></footer>|' report-v${{ env.VERSION }}/treasury_calculation.html
- name: 📅 Publish report to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: gh-pages
folder: report-v${{ env.VERSION }}
target-folder: report-latest/
- name: 📅 Publish report to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: gh-pages
folder: report-v${{ env.VERSION }}
target-folder: report-v${{ env.VERSION }}/