Skip to content

Commit a24a0f4

Browse files
ci: use release-and-delivery action to perform release and delivery
1 parent 841a903 commit a24a0f4

File tree

2 files changed

+22
-48
lines changed

2 files changed

+22
-48
lines changed

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

Lines changed: 21 additions & 47 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/wrapper-validation-action@v1.0.5
22+
2223
build:
2324
needs:
2425
- validation
@@ -44,16 +45,16 @@ jobs:
4445
uses: codecov/codecov-action@v3.1.1
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,55 +63,28 @@ 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/login-action@v2.1.0
70+
- name: Release and container delivery
71+
uses: SmartOperatingBlock/release-and-delivery-action@1.0.0
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/build-push-action@v4.0.0
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-
if: needs.release.outputs.release-status == 'released'
87+
if: needs.release-and-delivery.outputs.release-status == 'released'
11488
steps:
11589
- name: Checkout the repository
11690
uses: actions/checkout@v3
@@ -125,12 +99,12 @@ jobs:
12599
code-documentation-dst-folder: './build/dokka/html'
126100
code-documentation-site-folder: 'documentation/code-doc'
127101
github-token: ${{ secrets.GITHUB_TOKEN }}
102+
128103
success:
129-
runs-on: ubuntu-22.04
104+
runs-on: ubuntu-latest
130105
needs:
131106
- build
132-
- release
133-
- docker-image-delivery
107+
- release-and-delivery
134108
- documentation-deploy
135109
if: >-
136110
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)