-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
216 lines (177 loc) · 7.87 KB
/
ci.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: CI
on:
push:
branches:
- main
jobs:
build:
if: github.repository == 'jaywcjlove/reference'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm run build
- run: cp -rp icons ./dist
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
id: contributors
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: dist/CONTRIBUTORS.svg
avatarSize: 42
- name: Modify CONTRIBUTING.md
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: CONTRIBUTING.md
body: |
${{steps.contributors.outputs.htmlList}}
- name: Modify README.md
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: README.md
body: |
${{steps.contributors.outputs.htmlList}}
- name: Create Tag
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./package.json
- name: gh-pages README.md
working-directory: dist
run: |
cat << "EOF" > README.md
Website: https://jaywcjlove.github.io/reference
## Docker
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) [![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference)
轻松通过 `docker` 部署 `Quick Reference` 网站。
```bash
docker pull wcjiang/reference
```
```bash
docker run --name reference --rm -d -p 9667:3000 wcjiang/reference:latest
# Or
docker run --name reference -itd -p 9667:3000 wcjiang/reference:latest
```
在浏览器中访问以下 URL
```bash
http://localhost:9667/
```
EOF
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
filter-author: (小弟调调™|\@github-actions-bot\@renovate-bot|dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot)
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
- name: Create Release
uses: jaywcjlove/create-tag-action@main
if: steps.create_tag.outputs.successful
with:
package-path: ./package.json
version: ${{steps.create_tag.outputs.version}}
release: true
prerelease: false
draft: false
body: |
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/reference/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
## Docker
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference)
轻松通过 `docker` 部署 `Quick Reference` 网站。
```bash
docker pull wcjiang/reference
```
```bash
docker run --name reference --rm -d -p 9667:3000 wcjiang/reference:latest
# Or
docker run --name reference -itd -p 9667:3000 wcjiang/reference:latest
```
在浏览器中访问以下 URL
```bash
http://localhost:9667/
```
# Create Docker Image
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: docker buildx prune
- name: Build and push image:latest
uses: docker/build-push-action@v5
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: wcjiang/reference:latest
- name: Build and push image:tags
uses: docker/build-push-action@v5
if: steps.create_tag.outputs.successful
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: wcjiang/reference:${{steps.changelog.outputs.version}}
# # Create Docker Image in Github
# - name: Login to the GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Build and push image:latest
# uses: docker/build-push-action@v3
# with:
# push: true
# context: .
# platforms: linux/amd64,linux/arm64
# tags: ghcr.io/jaywcjlove/reference:latest
# - name: Build and push image:tags
# uses: docker/build-push-action@v3
# if: steps.create_tag.outputs.successful
# with:
# push: true
# context: .
# platforms: linux/amd64,linux/arm64
# tags: ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# # Create Docker Image in Github
# - name: Login to GitHub registry
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# - name: Build docker image
# run: docker build -t ghcr.io/jaywcjlove/reference:latest .
# - name: Publish to GitHub registry
# run: docker push ghcr.io/jaywcjlove/reference:latest
# - name: Tag docker image (beta) and publish to GitHub registry
# if: steps.create_tag.outputs.successful
# run: |
# echo "version: v${{ steps.changelog.outputs.version }}"
# docker tag ghcr.io/jaywcjlove/reference:latest ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# docker push ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# # Create Docker Image
# - name: Docker login
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
# - name: Build reference image
# run: docker image build -t reference .
# - name: Tags & Push image(latest)
# run: |
# echo "DOCKER_USER: ${{ secrets.DOCKER_USER }}"
# docker tag reference ${{ secrets.DOCKER_USER }}/reference:latest
# docker push ${{ secrets.DOCKER_USER }}/reference:latest
# - name: Tags & Push image
# if: steps.create_tag.outputs.successful
# run: |
# echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
# docker tag reference ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
# docker push ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}