-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (107 loc) · 3.35 KB
/
antmarky.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: antmarky
on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
node-setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '16'
- run: npm i
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run-lint:
name: ✅ Linter
needs: node-setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '16'
- name: ✅ Run code style linter
id: linter
run: npm run lint
run-tests:
name: 🧪 Tests
needs: node-setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '16'
- name: 🧪 Run tests
id: tests
run: npm test
- name: 📈 Send test coverage to Coveralls
id: coverage
if: steps.tests.outcome == 'success'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
generate-docs:
name: 📚 Generate documentation
needs: [run-tests, run-lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '16'
- name: 📚 Generate documentation
id: build_docs
if: steps.cache-node-modules.outcome == 'success'
run: npm run build
- name: 🚀 Deploy to GitHub Pages
if: steps.build_docs.outcome == 'success' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
generate-release:
name: 📦 Generate GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: generate-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create a GitHub release
uses: softprops/action-gh-release@v1
with:
body: 'This release was generated automatically. Full details will be available soon'
draft: true
build-docker-image:
name: 🐋 Build and push Docker image
needs: generate-docs
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 📝 Get Docker metadata
id: docker_meta
uses: docker/metadata-action@v3
with:
images: bandantonio/antmarky
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: 🔑 Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: 📦 🚀 Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}