Skip to content

Commit

Permalink
Reference reusable workflow in remote repository
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderschramm1992 committed May 24, 2024
1 parent d1e8b18 commit 14a85e0
Showing 1 changed file with 4 additions and 73 deletions.
77 changes: 4 additions & 73 deletions .github/workflows/build_releasecandidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,77 +9,8 @@ on:
tags:
- "[2-9][0-9][0-9][0-9].[0-9]+-RC[0-9]+"

# 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@v3
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/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

# 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: Execute Gradle Build
uses: gradle/gradle-build-action@v2
env:
CI: true
with:
gradle-version: wrapper
arguments: 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 }}
call_workflow_build_pr:
uses: isaqb-org/github-workflows/.github/workflows/build_releasecandidate.yml@main
with:
release_version: env.RELEASE_VERSION

0 comments on commit 14a85e0

Please sign in to comment.