-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (83 loc) · 2.49 KB
/
Copy pathci.yml
File metadata and controls
89 lines (83 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: mock-server CI
on:
push:
branches: [ master ]
tags: '*'
pull_request:
branches: [ master ]
jobs:
qa:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: './coverage/lcov.info'
base-path: './'
npm-publish:
name: npm publish
needs: qa
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
docker-build:
name: Build docker
needs: qa
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=staticdeploy/mock-server
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
VERSION=$(echo ${VERSION} | sed s/^v//)
elif [[ $GITHUB_REF == refs/heads/main ]]; then
VERSION=latest
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=image::${DOCKER_IMAGE}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.prep.outputs.tags }}