Skip to content

Commit 5940261

Browse files
committed
chore: fix for docker-deploy
1 parent 6b950c5 commit 5940261

File tree

3 files changed

+168
-134
lines changed

3 files changed

+168
-134
lines changed

.github/workflows/docker-deploy.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: deploy to docker hub
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
branches:
8+
- 'master'
9+
10+
env:
11+
# Use docker.io for Docker Hub if empty
12+
REGISTRY: ${{ secrets.REGISTRY }}
13+
# github.repository as <account>/<repo>
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
docker-deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
-
21+
name: Checkout
22+
uses: actions/checkout@v4
23+
# -
24+
# name: Set up QEMU
25+
# uses: docker/setup-qemu-action@v3
26+
# -
27+
# name: Set up Docker Buildx
28+
# uses: docker/setup-buildx-action@v3
29+
# 提供 docker 元数据,构建 docker images tag 时使用
30+
-
31+
name: Extract Docker metadata
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ${{ env.IMAGE_NAME }}
36+
tags: |
37+
# set latest tag for default branch
38+
type=raw,value=latest,enable={{is_default_branch}}
39+
# tag event
40+
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
41+
-
42+
name: Login to Docker Hub
43+
uses: docker/login-action@v3
44+
with:
45+
# registry: ghcr.io # 声明镜像源
46+
username: ${{ secrets.DOCKER_USERNAME }}
47+
password: ${{ secrets.DOCKER_PASSWORD }}
48+
-
49+
name: Build and push
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: .
53+
# platforms: linux/amd64,linux/arm64
54+
push: ${{ github.event_name != 'pull_request' }}
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
58+
# -
59+
# name: Login to Docker Hub
60+
# run: |
61+
# docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }}
62+
# -
63+
# name: Build and push Docker Image
64+
# run: |
65+
# docker build -t ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }} -f Dockerfile .
66+
# docker push ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }}
67+
68+
# -
69+
# name: Deploy Docker App
70+
# uses: appleboy/ssh-action@master
71+
# env:
72+
# TZ: Asia/Shanghai
73+
# with:
74+
# host: ${{ secrets.HOST }}
75+
# username: ${{ secrets.HOST_USERNAME }}
76+
# key: ${{ secrets.HOST_SSHKEY }}
77+
# port: ${{ secrets.PORT }}
78+
# script: |
79+
# wget https://raw.githubusercontent.com/${{ env.IMAGE_NAME }}/master/docker/docker-compose.yml
80+
# ls
81+
# cat docker-compose.yml
82+
# docker-compose down -v
83+
# docker-compose up -d

.github/workflows/npm-publish.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
2+
3+
name: Publish to NPM
4+
5+
on:
6+
push:
7+
tags:
8+
- "v*.*.*"
9+
# release:
10+
# types: [created]
11+
12+
jobs:
13+
npm-publish:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
steps:
20+
-
21+
name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
submodules: 'recursive'
25+
-
26+
name: Install Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 18
30+
registry-url: https://registry.npmjs.com
31+
-
32+
name: Install pnpm
33+
uses: pnpm/action-setup@v2
34+
id: pnpm-install
35+
with:
36+
version: 8
37+
run_install: false
38+
-
39+
name: Get pnpm store directory
40+
id: pnpm-cache
41+
shell: bash
42+
run: |
43+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
44+
-
45+
name: Setup pnpm cache
46+
uses: actions/cache@v3
47+
with:
48+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
49+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
50+
restore-keys: |
51+
${{ runner.os }}-pnpm-store-
52+
-
53+
name: Install dependencies
54+
run: pnpm install --no-frozen-lockfile --ignore-scripts
55+
56+
# - name: Build and npm-publish
57+
# run: npm run release
58+
59+
- run: npm publish
60+
env:
61+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
62+
63+
# run: npm run publish:github # --registry=https://npm.pkg.github.com
64+
# env:
65+
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
66+
67+
# - name: GitHub Pages action
68+
# uses: peaceiris/actions-gh-pages@v3
69+
# with:
70+
# github_token: ${{ secrets.GITHUB_TOKEN }}
71+
# publish_dir: ./docs
72+
-
73+
name: Github Release
74+
uses: softprops/action-gh-release@v1
75+
if: startsWith(github.ref, 'refs/tags/')
76+
with:
77+
draft: false
78+
prerelease: false
79+
# tag_name: ${{ github.ref }}
80+
# name: Release ${{ github.ref }}
81+
# body: TODO New Release.
82+
# files: |
83+
# ${{ secrets.ReleaseZipName }}.zip
84+
# LICENSE
85+

.github/workflows/release.yml

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)