-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (51 loc) · 1.56 KB
/
deploy-to-docker.yaml
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
name: Deploy to Docker
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "19"
- name: Install Pnpm
run: npm install pnpm -g
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm run build
- name: Update version and commit
id: version
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
echo ::set-output name=new-version::$(npm version patch)
git commit -m "chore(release): $new-version [skip ci]"
if: ${{ always() }}
- name: Set Docker Buildx
uses: docker/setup-buildx-action@v1
if: ${{ always() }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: ${{ always() }}
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
wu529778790/wallpaper.shenzjd.com:${{ steps.version.outputs.new-version }}
wu529778790/wallpaper.shenzjd.com:latest
if: ${{ always() }}
- name: Push Git changes
run: |
git push
if: ${{ always() }}