Skip to content

Commit b000d7c

Browse files
ci: change workflow for new release custom action
1 parent 1bc6e34 commit b000d7c

File tree

2 files changed

+18
-49
lines changed

2 files changed

+18
-49
lines changed

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

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ jobs:
4747
with:
4848
directory: "build/reports/jacoco"
4949

50-
release:
50+
release-and-delivery:
5151
concurrency:
5252
# Allow only one release at a time.
53-
group: release-${{ github.event.number || github.ref }}
53+
group: release-and-delivery-${{ github.event.number || github.ref }}
5454
needs:
5555
- build
5656
runs-on: ubuntu-latest
5757
outputs:
5858
release-status: ${{ env.release_status }}
59-
release-version: ${{ env.release_version }}
6059
# Release only where secrets are available.
6160
if: >-
6261
!github.event.repository.fork
@@ -65,57 +64,28 @@ jobs:
6564
|| github.event.pull_request.head.repo.full_name == github.repository
6665
)
6766
steps:
68-
- name: Checkout the repository
69-
uses: actions/checkout@v3
70-
with:
71-
token: ${{ secrets.DEPLOYMENT_TOKEN }}
72-
submodules: recursive
73-
fetch-depth: 0
7467
- name: Setup Node.js
7568
uses: actions/setup-node@v3
7669
with:
7770
node-version: "lts/*"
78-
- name: Release
79-
env:
80-
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_TOKEN }}
81-
run: |
82-
npm install
83-
npx semantic-release
84-
85-
docker-image-delivery:
86-
needs:
87-
- release
88-
runs-on: ubuntu-latest
89-
if: needs.release.outputs.release-status == 'released'
90-
env:
91-
REGISTRY: ghcr.io
92-
IMAGE_NAME: ${{ github.repository }}
93-
steps:
94-
- name: Checkout the repository
95-
uses: actions/checkout@v3
96-
with:
97-
submodules: recursive
98-
fetch-depth: 0
99-
- name: Login to GitHub Container registry
100-
uses: docker/[email protected]
71+
- name: Release and container delivery
72+
uses: SmartOperatingBlock/[email protected]
10173
with:
102-
registry: ${{ env.REGISTRY }}
103-
username: ${{ github.actor }}
104-
password: ${{ secrets.GITHUB_TOKEN }}
105-
- id: full-image-name
106-
run: echo "image-name=${{env.REGISTRY}}/${{env.IMAGE_NAME}}" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
107-
- name: Build and push the image to GitHub Container registry
108-
uses: docker/[email protected]
109-
with:
110-
context: .
111-
push: true
112-
tags: ${{ steps.full-image-name.outputs.image-name }}:latest, ${{ steps.full-image-name.outputs.image-name }}:${{ needs.release.outputs.release-version }}
74+
should-release: true
75+
release-command: |
76+
npm install
77+
npx semantic-release
78+
should-build-and-deliver-container: true
79+
container-registry-name: 'ghcr.io'
80+
container-registry-username: ${{ github.actor }}
81+
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
82+
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
11383

11484
documentation-deploy:
11585
needs:
116-
- release
86+
- release-and-delivery
11787
runs-on: ubuntu-latest
118-
if: needs.release.outputs.release-status == 'released'
88+
if: needs.release-and-delivery.outputs.release-status == 'released'
11989
steps:
12090
- name: Checkout the repository
12191
uses: actions/checkout@v3
@@ -135,11 +105,10 @@ jobs:
135105
github-token: ${{ secrets.GITHUB_TOKEN }}
136106

137107
success:
138-
runs-on: ubuntu-22.04
108+
runs-on: ubuntu-latest
139109
needs:
140110
- build
141-
- release
142-
- docker-image-delivery
111+
- release-and-delivery
143112
- documentation-deploy
144113
if: >-
145114
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)