Skip to content

Commit 88d21a3

Browse files
ci: migrate to GHA (#213)
ci: add conventional commit check ci: migrate cli PR checks to gha ci: migrate api PR checks to gha ci: configure release-please ci: migrate npm package publication to gha ci: migrate API build and deployment to gha
1 parent d91d9c2 commit 88d21a3

23 files changed

+537
-298
lines changed

.drone-consider

Lines changed: 0 additions & 3 deletions
This file was deleted.

.drone.yml

Lines changed: 0 additions & 122 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: API deploy release
2+
description: Build and deploy the API when a release is published
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
get-version:
10+
# only run for releases with tag 'iapp-api-v*' as created by release-please for API
11+
if: startsWith(github.ref_name,'iapp-api-v')
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
- name: Set publish version
21+
id: set-publish-version
22+
working-directory: api
23+
run: |
24+
VERSION=$(npm pkg get version | tr -d '"')
25+
echo "VERSION=${VERSION}" | tee -a $GITHUB_OUTPUT
26+
outputs:
27+
version: ${{ steps.set-publish-version.outputs.VERSION }}
28+
29+
docker-publish:
30+
if: startsWith(github.ref_name,'iapp-api-v')
31+
needs: get-version
32+
uses: ./.github/workflows/reusable-api-docker.yml
33+
with:
34+
tag: ${{ needs.get-version.outputs.version }}
35+
secrets:
36+
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
docker-password: ${{ secrets.DOCKERHUB_PAT }}
38+
39+
deploy:
40+
if: startsWith(github.ref_name,'iapp-api-v')
41+
needs: get-version
42+
uses: ./.github/workflows/reusable-api-deploy.yml
43+
with:
44+
tag: ${{ needs.get-version.outputs.version }}
45+
secrets:
46+
host: ${{ secrets.API_HOST }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: API deploy rollback
2+
description: Rollback the API deployment to a previous version
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version Tag to rollback to'
9+
required: true
10+
type: string
11+
12+
jobs:
13+
deploy:
14+
if: ${{ github.ref_name == 'main' }}
15+
uses: ./.github/workflows/reusable-api-deploy.yml
16+
with:
17+
tag: ${{ inputs.version }}
18+
secrets:
19+
host: ${{ secrets.API_HOST }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: API docker publish staging
2+
description: Publish a staging version of the API on Docker Hub
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
compute-staging-version:
9+
uses: ./.github/workflows/reusable-compute-staging-version.yml
10+
with:
11+
working-directory: api
12+
13+
docker-publish:
14+
needs: compute-staging-version
15+
uses: ./.github/workflows/reusable-api-docker.yml
16+
with:
17+
tag: ${{ needs.compute-staging-version.outputs.version }}
18+
secrets:
19+
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
docker-password: ${{ secrets.DOCKERHUB_PAT }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: API PR checks
2+
description: check the API PR
3+
4+
on:
5+
pull_request:
6+
paths: ['api/**']
7+
8+
concurrency:
9+
group: ${{ github.ref }}-api-pr-checks
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check-code:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
cache-dependency-path: 'api/package-lock.json'
25+
26+
- name: Install dependencies
27+
working-directory: api
28+
run: npm ci
29+
30+
- name: Check types
31+
working-directory: api
32+
run: npm run check-types
33+
34+
- name: Check format
35+
working-directory: api
36+
run: npm run check-format
37+
38+
- name: Lint
39+
working-directory: api
40+
run: npm run lint
41+
42+
docker-dry-run:
43+
uses: ./.github/workflows/reusable-api-docker.yml
44+
with:
45+
dry-run: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CLI npm publish latest
2+
description: Publish iapp CLI on npm when a release is published
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
npm-publish:
10+
# only run for releases with tag 'iapp-v*' as created by release-please for CLI
11+
if: startsWith(github.ref_name,'iapp-v')
12+
uses: ./.github/workflows/reusable-cli-npm.yml
13+
with:
14+
tag: 'latest'
15+
secrets:
16+
npm-token: ${{ secrets.NPM_TOKEN }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CLI npm publish staging
2+
description: Publish a staging version of iapp CLI on npm
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
compute-staging-version:
9+
uses: ./.github/workflows/reusable-compute-staging-version.yml
10+
with:
11+
working-directory: cli
12+
13+
npm-publish:
14+
uses: ./.github/workflows/reusable-cli-npm.yml
15+
needs: compute-staging-version
16+
with:
17+
version: ${{ needs.compute-staging-version.outputs.version }}
18+
tag: ${{ needs.compute-staging-version.outputs.dist-tag }}
19+
secrets:
20+
npm-token: ${{ secrets.NPM_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CLI PR checks
2+
description: check the CLI PR
3+
4+
on:
5+
pull_request:
6+
paths: ['cli/**']
7+
8+
concurrency:
9+
group: ${{ github.ref }}-cli-pr-checks
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check-code:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
cache-dependency-path: 'cli/package-lock.json'
25+
26+
- name: Install dependencies
27+
working-directory: cli
28+
run: npm ci
29+
30+
- name: Build
31+
working-directory: cli
32+
run: npm run build
33+
34+
- name: Check format
35+
working-directory: cli
36+
run: npm run check-format
37+
38+
- name: Lint
39+
working-directory: cli
40+
run: npm run lint
41+
42+
- name: Test no crash
43+
working-directory: cli
44+
run: |
45+
npm i -g .
46+
iapp -h
47+
48+
npm-dry-run:
49+
uses: ./.github/workflows/reusable-cli-npm.yml
50+
with:
51+
dry-run: true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Conventional Commit Check Commits
2+
description: checks every commit in the PR respects the conventional commit
3+
4+
on: [pull_request]
5+
6+
jobs:
7+
check-conventional-commits:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Check Commit Conventions
12+
uses: webiny/[email protected]

0 commit comments

Comments
 (0)