Skip to content

Commit 133b5d4

Browse files
ci: use release and delivery and documentation ghp actions
1 parent bdb4ad5 commit 133b5d4

File tree

2 files changed

+29
-60
lines changed

2 files changed

+29
-60
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: actions/checkout@v3
2020
- name: Validate the Gradle Wrapper
2121
uses: gradle/[email protected]
22+
2223
build:
2324
needs:
2425
- validation
@@ -44,16 +45,16 @@ jobs:
4445
uses: codecov/[email protected]
4546
with:
4647
directory: "build/reports/jacoco"
47-
release:
48+
49+
release-and-delivery:
4850
concurrency:
4951
# Allow only one release at a time.
50-
group: release-${{ github.event.number || github.ref }}
52+
group: release-and-delivery-${{ github.event.number || github.ref }}
5153
needs:
5254
- build
5355
runs-on: ubuntu-latest
5456
outputs:
5557
release-status: ${{ env.release_status }}
56-
release-version: ${{ env.release_version }}
5758
# Release only where secrets are available.
5859
if: >-
5960
!github.event.repository.fork
@@ -62,80 +63,48 @@ jobs:
6263
|| github.event.pull_request.head.repo.full_name == github.repository
6364
)
6465
steps:
65-
- name: Checkout the repository
66-
uses: actions/checkout@v3
67-
with:
68-
token: ${{ secrets.DEPLOYMENT_TOKEN }}
69-
submodules: recursive
70-
fetch-depth: 0
7166
- name: Setup Node.js
7267
uses: actions/setup-node@v3
7368
with:
7469
node-version: "lts/*"
75-
- name: Release
76-
env:
77-
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_TOKEN }}
78-
run: |
79-
npm install
80-
npx semantic-release
81-
docker-image-delivery:
82-
needs:
83-
- release
84-
runs-on: ubuntu-latest
85-
if: needs.release.outputs.release-status == 'released'
86-
env:
87-
REGISTRY: ghcr.io
88-
IMAGE_NAME: ${{ github.repository }}
89-
steps:
90-
- name: Checkout the repository
91-
uses: actions/checkout@v3
92-
with:
93-
submodules: recursive
94-
fetch-depth: 0
95-
- name: Login to GitHub Container registry
96-
uses: docker/[email protected]
70+
- name: Release and container delivery
71+
uses: SmartOperatingBlock/[email protected]
9772
with:
98-
registry: ${{ env.REGISTRY }}
99-
username: ${{ github.actor }}
100-
password: ${{ secrets.GITHUB_TOKEN }}
101-
- id: full-image-name
102-
run: echo "image-name=${{env.REGISTRY}}/${{env.IMAGE_NAME}}" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
103-
- name: Build and push the image to GitHub Container registry
104-
uses: docker/[email protected]
105-
with:
106-
context: .
107-
push: true
108-
tags: ${{ steps.full-image-name.outputs.image-name }}:latest, ${{ steps.full-image-name.outputs.image-name }}:${{ needs.release.outputs.release-version }}
73+
should-release: true
74+
release-command: |
75+
npm install
76+
npx semantic-release
77+
should-build-and-deliver-container: true
78+
container-registry-name: 'ghcr.io'
79+
container-registry-username: ${{ github.actor }}
80+
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
81+
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
82+
10983
documentation-deploy:
11084
needs:
111-
- release
85+
- release-and-delivery
11286
runs-on: ubuntu-latest
113-
# Update documentation only when there is a new release
114-
if: needs.release.outputs.release-status == 'released'
87+
if: needs.release-and-delivery.outputs.release-status == 'released'
11588
steps:
11689
- name: Checkout the repository
11790
uses: actions/checkout@v3
11891
with:
11992
submodules: recursive
12093
fetch-depth: 0
121-
- name: Generate Documentation
122-
run: ./gradlew dokkaHtml
123-
- name: Deploy documentation on GitHub Pages
124-
uses: peaceiris/actions-gh-pages@v3
94+
- name: Generate and deploy documentation
95+
uses: SmartOperatingBlock/[email protected]
12596
with:
126-
github_token: ${{ secrets.GITHUB_TOKEN }}
127-
keep_files: true
128-
publish_dir: ./build/dokka/html
129-
destination_dir: kdoc
130-
user_name: 'github-actions[bot]'
131-
user_email: 'github-actions[bot]@users.noreply.github.com'
132-
commit_message: 'docs: update documentation'
97+
should-generate-code-documentation: true
98+
code-documentation-generation-command: ./gradlew dokkaHtml
99+
code-documentation-dst-folder: './build/dokka/html'
100+
code-documentation-site-folder: 'documentation/code-doc'
101+
github-token: ${{ secrets.GITHUB_TOKEN }}
102+
133103
success:
134-
runs-on: ubuntu-22.04
104+
runs-on: ubuntu-latest
135105
needs:
136106
- build
137-
- release
138-
- docker-image-delivery
107+
- release-and-delivery
139108
- documentation-deploy
140109
if: >-
141110
always() && (

release.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const publishCommands = `
99
git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md || exit 2
1010
git push --force origin \${nextRelease.version} || exit 3
1111
echo "release_status=released" >> $GITHUB_ENV
12-
echo "release_version="\${nextRelease.version} >> $GITHUB_ENV
12+
echo "CONTAINER_VERSION="\${nextRelease.version} >> $GITHUB_ENV
1313
`
1414
// Only release on branch main
1515
const releaseBranches = ["main"]

0 commit comments

Comments
 (0)