1
1
# see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
2
2
3
- name : Publish Package to npmjs
3
+ name : Publish to NPM
4
4
5
5
on :
6
6
push :
@@ -23,39 +23,40 @@ jobs:
23
23
concurrency :
24
24
group : ${{ github.workflow }}-${{ github.ref }}
25
25
steps :
26
- - name : Checkout
27
- uses : actions/checkout@v3
26
+ -
27
+ name : Checkout
28
+ uses : actions/checkout@v4
28
29
with :
29
30
submodules : ' recursive'
30
-
31
- - name : Install Node.js
31
+ -
32
+ name : Install Node.js
32
33
uses : actions/setup-node@v3
33
34
with :
34
35
node-version : 18
35
36
registry-url : https://registry.npmjs.com
36
-
37
- - uses : pnpm/action-setup@v2
37
+ -
38
38
name : Install pnpm
39
+ uses : pnpm/action-setup@v2
39
40
id : pnpm-install
40
41
with :
41
42
version : 8
42
43
run_install : false
43
-
44
- - name : Get pnpm store directory
44
+ -
45
+ name : Get pnpm store directory
45
46
id : pnpm-cache
46
47
shell : bash
47
48
run : |
48
49
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
49
-
50
- - uses : actions/cache@v3
50
+ -
51
51
name : Setup pnpm cache
52
+ uses : actions/cache@v3
52
53
with :
53
54
path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
54
55
key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
55
56
restore-keys : |
56
57
${{ runner.os }}-pnpm-store-
57
-
58
- - name : Install dependencies
58
+ -
59
+ name : Install dependencies
59
60
run : pnpm install --no-frozen-lockfile --ignore-scripts
60
61
61
62
# - name: Build and npm-publish
74
75
# with:
75
76
# github_token: ${{ secrets.GITHUB_TOKEN }}
76
77
# publish_dir: ./docs
77
-
78
- - name : Github Release
78
+ -
79
+ name : Github Release
79
80
uses : softprops/action-gh-release@v1
80
81
if : startsWith(github.ref, 'refs/tags/')
81
82
with :
88
89
# ${{ secrets.ReleaseZipName }}.zip
89
90
# LICENSE
90
91
91
- docker-deploy :
92
- runs-on : ubuntu-latest
93
- steps :
94
-
95
- # 提供 docker 元数据,构建 docker images tag 时使用
96
- - name : Extract Docker metadata
97
- id : meta
98
- uses : docker/metadata-action@v4
99
- with :
100
- images : ${{ env.IMAGE_NAME }}
101
- tags : |
102
- # set latest tag for default branch
103
- type=raw,value=latest,enable={{is_default_branch}}
104
- # tag event
105
- type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
106
-
107
- # 构建镜像 使用 docker/Build-And-push@v5 插件有问题
108
- - uses : actions/checkout@v2
109
- - name : Build Docker Image
110
- run : |
111
- docker build -t ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }} -f ./docker/nginx/Dockerfile .
112
- - name : Push Docker Image
113
- run : |
114
- docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }}
115
- docker push ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }}
116
-
117
- # 运行 docker 服务
118
- # 另外一种选择是通过 scp 将文件传到指定服务器,完成 docker-compose 启动
119
- # - name: Deploy Docker App
120
- # uses: appleboy/ssh-action@master
121
- # env:
122
- # TZ: Asia/Shanghai
123
- # with:
124
- # host: ${{ secrets.HOST }}
125
- # username: ${{ secrets.HOST_USERNAME }}
126
- # key: ${{ secrets.HOST_SSHKEY }}
127
- # port: ${{ secrets.PORT }}
128
- # script: |
129
- # # 获取 docker-compose 文件
130
- # wget https://raw.githubusercontent.com/${{ env.IMAGE_NAME }}/master/docker/docker-compose.yml
131
- # ls
132
- # cat docker-compose.yml
133
- # docker-compose down -v
134
- # docker-compose up -d
0 commit comments