-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (85 loc) · 2.29 KB
/
Copy pathupdater_image.yml
File metadata and controls
89 lines (85 loc) · 2.29 KB
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
name: Updater Image
permissions:
actions: write
contents: read
on:
workflow_dispatch:
push:
branches:
- master
- dev
tags:
- 'v*'
paths:
- .github/workflows/updater_image.yml
- '!services/bot/**'
- services/updater/**
- packages/**
- package.json
- turbo.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
- .npmrc
- .gitignore
- docker-compose.yml
pull_request:
types: [opened, reopened, edited, synchronize]
branches:
- master
jobs:
should_skip:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
do_not_skip: '["pull_request"]'
cancel_others: true
skip_after_successful_duplicate: false
docker:
needs: should_skip
if: needs.should_skip.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
-
name: Image Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
battlesquid0101/qnaplus-updater
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set NODE_ENV
id: node_env
run: |
if [[ "${{ github.ref_name }}" == "master" ]]; then
echo "value=production" >> $GITHUB_OUTPUT
else
echo "value=development" >> $GITHUB_OUTPUT
fi
-
name: Build and push
uses: docker/build-push-action@v5
with:
push: true
file: services/updater/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
NODE_ENV=${{ steps.node_env.outputs.value }}