-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
228 lines (187 loc) · 8.39 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
217
218
219
220
221
222
223
224
225
226
227
228
name: CI
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
id: contributors
with:
filter-author: (renovate\[bot\]|renovate-bot|@github-actions-bot|dependabot\[bot\])
avatarSize: 42
- name: Modify README.md
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: README.md
openDelimiter: '<!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-->'
closeDelimiter: '<!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-END-->'
body: |
${{steps.contributors.outputs.htmlList}}
- name: Modify contributors.ejs
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: template/contributors.ejs
openDelimiter: '<!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-->'
closeDelimiter: '<!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-END-->'
body: |
${{steps.contributors.outputs.htmlList}}
- run: npm install
- run: npm run dash
- run: cp CONTRIBUTORS.svg .deploy
- name: Build Linux Command
run: |
npm install
npm run dash
cp CONTRIBUTORS.svg .deploy
- name: Create Tag
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./package.json
- name: Get Tag Version
id: tag_version
uses: jaywcjlove/changelog-generator@main
- name: Update Dash Feed
run: |
echo "<entry><version>${{steps.create_tag.outputs.versionNumber}}</version><url>https://jaywcjlove.github.io/linux-command/linux-command.docset.tgz</url></entry>" > .deploy/linux-command-docset.xml
- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
filter-author: (小弟调调™)
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
- name: Create Release
uses: ncipollo/release-action@v1
if: steps.create_tag.outputs.successful
with:
allowUpdates: true
artifacts: '.deploy/linux-command.docset.tgz'
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.create_tag.outputs.version }}
tag: ${{ steps.create_tag.outputs.version }}
body: |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/linux-command@${{steps.create_tag.outputs.versionNumber}}/file/README.md) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/linux-command)](https://bundlephobia.com/result?p=linux-command@${{steps.create_tag.outputs.versionNumber}})
```bash
npm i linux-command@${{steps.create_tag.outputs.versionNumber}}
```
${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
Document linux-command@${{ steps.changelog.outputs.tag }}:
https://raw.githack.com/jaywcjlove/linux-command/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
## Docker
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command)
轻松通过 `docker` 部署 `linux-command` 网站。
```bash
docker pull wcjiang/linux-command
```
```bash
docker run --name linux-command --rm -d -p 9665:3000 wcjiang/linux-command:latest
# Or
docker run --name linux-command -itd -p 9665:3000 wcjiang/linux-command:latest
```
在浏览器中访问以下 URL
```bash
http://localhost:9665/
```
- run: rm -rf .deploy/linux-command.docset
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: '[${{steps.tag_version.outputs.tag}}] ${{ github.event.head_commit.message }}'
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.deploy
user_name: github-actions[bot]
user_email: github-actions[bot]@users.noreply.github.com
- run: npm publish --access public --provenance
continue-on-error: true
name: 📦 linux-command publish to NPM
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# Create Docker Image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/#-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image:latest
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USER }}/linux-command:latest
- name: Build and push image:tags
uses: docker/build-push-action@v6
if: steps.create_tag.outputs.successful
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
# # Create Docker Image in Github
# - name: Login to the GitHub Container Registry
# uses: docker/#-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Build and push image:latest
# uses: docker/build-push-action@v6
# with:
# push: true
# context: .
# platforms: linux/amd64,linux/arm64
# tags: ghcr.io/jaywcjlove/linux-command:latest
# - name: Build and push image:tags
# uses: docker/build-push-action@v6
# if: steps.create_tag.outputs.successful
# with:
# push: true
# context: .
# platforms: linux/amd64,linux/arm64
# tags: ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
# # Create Docker Image
# - name: Docker login
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
# - name: Build linux-command image
# run: |
# rm -rf .deploy/linux-command.docset.tgz
# docker image build -t linux-command .
# - name: Tags & Push image(latest)
# run: |
# docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:latest
# docker push ${{ secrets.DOCKER_USER }}/linux-command:latest
# - name: Tags & Push image
# if: steps.create_tag.outputs.successful
# run: |
# echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
# docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
# docker push ${{ secrets.DOCKER_USER }}/linux-command:${{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/linux-command:latest .
# - name: Publish to GitHub registry
# run: docker push ghcr.io/jaywcjlove/linux-command: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/linux-command:latest ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
# docker push ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}