generated from SmartOperatingBlock/kotlin-template-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: integrate release and delivery and documentation ghp actions
- Loading branch information
1 parent
df81e3f
commit e764f82
Showing
1 changed file
with
31 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ jobs: | |
uses: actions/checkout@v3 | ||
- name: Validate the Gradle Wrapper | ||
uses: gradle/[email protected] | ||
|
||
build: | ||
needs: | ||
- validation | ||
|
@@ -44,16 +45,16 @@ jobs: | |
uses: codecov/[email protected] | ||
with: | ||
directory: "build/reports/jacoco" | ||
release: | ||
|
||
release-and-delivery: | ||
concurrency: | ||
# Allow only one release at a time. | ||
group: release-${{ github.event.number || github.ref }} | ||
group: release-and-delivery-${{ github.event.number || github.ref }} | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-status: ${{ env.release_status }} | ||
release-version: ${{ env.release_version }} | ||
# Release only where secrets are available. | ||
if: >- | ||
!github.event.repository.fork | ||
|
@@ -62,79 +63,51 @@ jobs: | |
|| github.event.pull_request.head.repo.full_name == github.repository | ||
) | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.DEPLOYMENT_TOKEN }} | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_TOKEN }} | ||
run: | | ||
npm install | ||
npx semantic-release | ||
docker-image-delivery: | ||
needs: | ||
- release | ||
runs-on: ubuntu-latest | ||
if: needs.release.outputs.release-status == 'released' | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Login to GitHub Container registry | ||
uses: docker/[email protected] | ||
- name: Release and container delivery | ||
uses: SmartOperatingBlock/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- id: full-image-name | ||
run: echo "image-name=${{env.REGISTRY}}/${{env.IMAGE_NAME}}" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
- name: Build and push the image to GitHub Container registry | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.full-image-name.outputs.image-name }}:latest, ${{ steps.full-image-name.outputs.image-name }}:${{ needs.release.outputs.release-version }} | ||
should-release: true | ||
release-command: | | ||
npm install | ||
npx semantic-release | ||
should-build-and-deliver-container: true | ||
container-registry-name: 'ghcr.io' | ||
container-registry-username: ${{ github.actor }} | ||
container-registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
github-token: ${{ secrets.DEPLOYMENT_TOKEN }} | ||
|
||
documentation-deploy: | ||
needs: | ||
- release | ||
- release-and-delivery | ||
runs-on: ubuntu-latest | ||
# Update documentation only when there is a new release | ||
if: needs.release.outputs.release-status == 'released' | ||
if: needs.release-and-delivery.outputs.release-status == 'released' | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Generate Documentation | ||
run: ./gradlew dokkaHtml | ||
- name: Deploy documentation on GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
- name: Generate and deploy documentation | ||
uses: SmartOperatingBlock/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
keep_files: true | ||
publish_dir: ./build/dokka/html | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: 'docs: update documentation' | ||
should-generate-code-documentation: true | ||
code-documentation-generation-command: ./gradlew dokkaHtml | ||
code-documentation-dst-folder: './build/dokka/html' | ||
code-documentation-site-folder: 'documentation/code-doc' | ||
should-generate-openapi-documentation: true | ||
openapi-documentation-input-file: 'docs/rest-api/rest-api-docs.yml' | ||
openapi-documentation-dst-folder: 'documentation/openapi-doc' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
success: | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- release | ||
- docker-image-delivery | ||
- release-and-delivery | ||
- documentation-deploy | ||
if: >- | ||
always() && ( | ||
|