Skip to content

Commit 291821e

Browse files
committed
ci: on tag push, push docker images
1 parent 1cc774e commit 291821e

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
11
name: CI
2-
32
on:
43
push:
54
branches:
65
- main
6+
tags:
7+
- 'v*'
78
pull_request:
89
branches:
910
- main
10-
1111
jobs:
1212
test-and-build:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout code
1616
uses: actions/checkout@v3
17-
1817
- name: Set up Node.js
1918
uses: actions/setup-node@v3
2019
with:
2120
node-version: '18'
22-
2321
- name: Install dependencies
2422
run: npm install
25-
2623
- name: Run tests
2724
run: npm run test
28-
2925
- name: Build project
3026
run: npm run build
31-
3227
e2e-test:
3328
name: 'Playwright Tests'
3429
runs-on: ubuntu-latest
@@ -55,33 +50,30 @@ jobs:
5550
needs:
5651
- test-and-build
5752
- e2e-test
58-
if: github.ref == 'refs/heads/main'
53+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
5954
steps:
6055
- name: Checkout code
6156
uses: actions/checkout@v3
62-
6357
- name: Set up QEMU
6458
uses: docker/setup-qemu-action@v2
6559
with:
6660
platforms: 'arm64,amd64'
67-
6861
- name: Set up Docker Buildx
6962
uses: docker/setup-buildx-action@v2
70-
7163
- name: Login to DockerHub
7264
uses: docker/login-action@v2
7365
with:
7466
username: ${{ secrets.DOCKERHUB_USERNAME }}
7567
password: ${{ secrets.DOCKERHUB_TOKEN }}
76-
7768
- name: Extract metadata for Docker
7869
id: meta
7970
uses: docker/metadata-action@v4
8071
with:
8172
images: iib0011/omni-tools
8273
tags: |
83-
type=raw,value=latest
84-
74+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
75+
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
76+
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
8577
- name: Build and push Docker image
8678
uses: docker/build-push-action@v4
8779
with:
@@ -101,18 +93,14 @@ jobs:
10193
steps:
10294
- name: Checkout code
10395
uses: actions/checkout@v3
104-
10596
- name: Set up Node.js
10697
uses: actions/setup-node@v3
10798
with:
10899
node-version: '18'
109-
110100
- name: Install dependencies
111101
run: npm install
112-
113102
- name: Build project
114103
run: npm run build
115-
116104
- name: Deploy to Netlify
117105
uses: nwtgck/actions-netlify@v1.2
118106
with:

0 commit comments

Comments
 (0)