Skip to content

main-release

main-release #19

Workflow file for this run

name: main-release
on:
workflow_dispatch:
inputs:
ver:
description: 'The version number, should be specified as a semantic version e.g: X.Y.Z'
required: true
release-notes:
description: 'The versions release notes'
required: true
jobs:
build:
runs-on: ubuntu-latest
env:
PUBLISH_URL: ${{ vars.PUBLISH_URL }}
PUBLISH_USERNAME: ${{ vars.PUBLISH_USERNAME }}
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
PUBLISH_VERSION: ${{ inputs.ver }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: benpollarduk/ktvn
token: ${{ secrets.PAT }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Execute Gradle build and test and then publish
run: |
sh ./gradlew build test :ktvn:publish -PpublishVersion=${PUBLISH_VERSION} -PpublishUrl=${PUBLISH_URL} -PpublishUsername=${PUBLISH_USERNAME} -PpublishPassword=${PUBLISH_PASSWORD}
- name: Tag the commit
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag -a "${{ inputs.ver }}" -m "${{ inputs.ver }} tagged during GitHub action"
git push --tags
- name: Install pip
run: |
sudo apt update
sudo apt install python3-pip
- name: Install mkdocs
run: |
pip install mkdocs-material
- name: Build mkdocs documentation
run: |
cd docs/mkdocs/
mkdocs build
- name: Copy website files, commit and tag, then push changes to ktvn-docs
run: |
mkdir ktvn-docs
cd ktvn-docs
git init
git remote add origin https://${{ secrets.PAT }}@github.com/benpollarduk/ktvn-docs.git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch
git checkout main
git rm -r --ignore-unmatch .
cp -r ../docs/mkdocs/site/* .
git add .
git commit -m "Update documentation"
git tag -a "${{ inputs.ver }}" -m "${{ inputs.ver }} tagged during GitHub action"
git push --follow-tags https://${{ secrets.PAT }}@github.com/benpollarduk/ktvn-docs.git HEAD:main
- name: Build dokka documentation
run: |
sh ./gradlew build test :ktvn:dokkaHtml -PpublishVersion=${PUBLISH_VERSION}
- name: Copy api website files, commit and tag, then push changes to ktvn-docs
run: |
mkdir ktvn-api-docs
cd ktvn-api-docs
git init
git remote add origin https://${{ secrets.PAT }}@github.com/benpollarduk/ktvn-api-docs.git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch
git checkout main
git rm -r --ignore-unmatch .
cp -r ../ktvn/build/dokka/html/* .
git add .
git commit -m "Update documentation"
git tag -a "${{ inputs.ver }}" -m "${{ inputs.ver }} tagged during GitHub action"
git push --follow-tags https://${{ secrets.PAT }}@github.com/benpollarduk/ktvn-api-docs.git HEAD:main
- name: Create GitHub release
uses: actions/create-release@v1
with:
tag_name: "${{ inputs.ver }}"
release_name: "${{ inputs.ver }}"
body: "${{ inputs.release-notes }}"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}