Skip to content

Commit d388edd

Browse files
authored
#6: workflow for releasing image (#38)
* add release workflow * unify gh workflows with backend * add codegen
1 parent 72ad6c4 commit d388edd

4 files changed

Lines changed: 78 additions & 34 deletions

File tree

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
name: Build Docker Image
1+
name: Build Application
22

33
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
4+
- push
85

96
jobs:
10-
image-build:
7+
build:
118
runs-on: ubuntu-latest
129

1310
steps:
@@ -25,5 +22,5 @@ jobs:
2522
- name: Generate code
2623
run: make gen
2724

28-
- name: Build Docker image
29-
run: make image-build
25+
- name: Build application
26+
run: make build

.github/workflows/build.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
name: Build Application
1+
name: Build image
22

33
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
4+
- push
85

96
jobs:
107
build:
118
runs-on: ubuntu-latest
12-
139
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
17-
- name: Setup Node.js
18-
uses: actions/setup-node@v4
19-
with:
20-
node-version: '20'
10+
- uses: actions/checkout@v6
11+
12+
- name: Set up Docker runtime
13+
uses: docker/setup-buildx-action@v3
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
20+
- name: Install dependencies
21+
run: yarn install
22+
23+
- name: Generate code
24+
run: make gen
2125

22-
- name: Install dependencies
23-
run: yarn install
24-
25-
- name: Generate code
26-
run: make gen
27-
28-
- name: Build application
29-
run: make build
26+
- name: Build image
27+
uses: docker/build-push-action@v6
28+
with:
29+
context: .
30+
push: false

.github/workflows/release.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
packages: write
12+
steps:
13+
- uses: actions/checkout@v6
14+
15+
- name: Set up Docker runtime
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Install dependencies
24+
run: yarn install
25+
26+
- name: Generate code
27+
run: make gen
28+
29+
- name: Log in to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Set image name
37+
run: echo "IMAGE_NAME=ghcr.io/hyperleda/hyperleda-webapp" >> $GITHUB_ENV
38+
39+
- name: Set short SHA
40+
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
41+
42+
- name: Build and push image
43+
uses: docker/build-push-action@v6
44+
with:
45+
context: .
46+
push: true
47+
tags: |
48+
${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }}
49+
${{ env.IMAGE_NAME }}:latest
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
name: Format and lint
1+
name: Static checks & tests
22

33
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
4+
- push
85

96
jobs:
107
lint:

0 commit comments

Comments
 (0)