Skip to content

Commit

Permalink
ci: fix autodoc publish on release
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Sep 5, 2024
1 parent 049399e commit 2c29695
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 33 deletions.
53 changes: 53 additions & 0 deletions .github/actions/publish-autodoc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Publish Autodoc"
description: "Build and publish autodoc to github pages"

inputs:
version:
description: the version to be attached to the autodoc, if not specified, the one configured in the project will be used
required: false
token:
description: the github token used for publication
required: true

runs:
using: "composite"
steps:
- uses: eclipse-edc/.github/.github/actions/setup-build@main

- name: Override version if input is set
shell: bash
if: "${{ inputs.version != '' }}"
run: sed -i "s/version=.*/version=${{ inputs.version }}/g" gradle.properties

- name: Generate docs
shell: bash
run: ./gradlew autodoc
- name: Merge manifests
shell: bash
run: ./gradlew mergeManifests
- name: Render markdown
shell: bash
run: ./gradlew doc2html

- name: extract version
shell: bash
run: echo "VERSION=$(grep version= gradle.properties | cut -c 9-)" >> $GITHUB_ENV

- name: Prepare deploy folder
shell: bash
run: |
mkdir -p deploy/autodoc/${{ env.VERSION }}
cp build/*.html deploy/autodoc/${{ env.VERSION }}/index.html
- name: Render html for stable version
shell: bash
if: ${{ !endsWith( env.VERSION, '-SNAPSHOT') }}
run: cp deploy/autodoc/${{ env.VERSION }}/index.html deploy/autodoc/index.html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ inputs.token }}
publish_dir: deploy
keep_files: true

11 changes: 9 additions & 2 deletions .github/workflows/core-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,12 @@ jobs:

publish-autodoc:
if: inputs.publish-autodoc == true
uses: eclipse-edc/.github/.github/workflows/publish-autodoc.yml@main
secrets: inherit
needs: [ Create-Tag ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- uses: eclipse-edc/.github/.github/actions/publish-autodoc@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 2 additions & 30 deletions .github/workflows/publish-autodoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: eclipse-edc/.github/.github/actions/setup-build@main

- name: Override version if input is set
if: "${{ inputs.version != '' }}"
run: sed -i "s/version=.*/version=${{ inputs.version }}/g" gradle.properties

- name: Generate docs
run: ./gradlew autodoc
- name: Merge manifests
run: ./gradlew mergeManifests
- name: Render markdown
run: ./gradlew doc2html

- name: extract version
run: echo "VERSION=$(grep version= gradle.properties | cut -c 9-)" >> $GITHUB_ENV

- name: Prepare deploy folder
run: |
mkdir -p deploy/autodoc/${{ env.VERSION }}
cp build/*.html deploy/autodoc/${{ env.VERSION }}/index.html
- name: Render html for stable version
if: ${{ !endsWith( env.VERSION, '-SNAPSHOT') }}
run: cp deploy/autodoc/${{ env.VERSION }}/index.html deploy/autodoc/index.html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
- uses: eclipse-edc/.github/.github/actions/publish-autodoc@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: deploy
keep_files: true
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/technology-prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ jobs:
**PLEASE NOTE: you have to close the PR and re-open it in order to run the checks.**
Details at: https://github.com/orgs/community/discussions/65321
Merging this PR will create a ${{ steps.vars.outputs.type }} branch for the ${{ inputs.version }} version
Merging this PR will create a ${{ steps.vars.outputs.type }} branch for the ${{ inputs.version }} version.
Release workflow will need to be triggered manually.

0 comments on commit 2c29695

Please sign in to comment.