-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (72 loc) · 2.95 KB
/
build_releasecandidate.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
name: Reusable Workflow for Release Candidates
on:
workflow_call:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Source
uses: actions/checkout@v4
with:
submodules: recursive
- name: Update index.adoc
run: |
rm docs/index.adoc
mv docs/index_rc.adoc docs/index.adoc
- name: Verify Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
# If we're building a release, we need to set the variable RELEASE_VERSION
- name: Set Environment Variables for Release Version
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Setup Gradle Build
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
- name: Execute Gradle build
run: ./gradlew buildDocs
# do the following two things only for a release!
- name: Prepare Deployment
if: startsWith(github.ref, 'refs/tags/')
run: |
rm -rf ./build/tmp
cp ./docs-ext/curriculum-*.pdf ./build 2>/dev/null || :
zip -r release.zip ./build
mkdir release_dir
cp ./build/curriculum-*.pdf ./release_dir 2>/dev/null || :
mv release.zip ./release_dir/release-${{ env.RELEASE_VERSION }}.zip
- name: Create New Release Candidate
if: startsWith(github.ref, 'refs/tags/')
id: create-release-candidate
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag: ${{ env.RELEASE_VERSION }}
name: Release Candidate ${{ env.RELEASE_VERSION }}
draft: false
prerelease: true
bodyFile: "CHANGELOG.md"
artifacts: "license-copyright/LICENSE.adoc,release_dir/*.pdf,release_dir/*.zip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy Release Candidate to GitHub Pages
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
destination_dir: release-candidate
keep_files: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: Publish Release Candidate ${{ env.RELEASE_VERSION }}