-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (60 loc) · 1.79 KB
/
pull-request.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
name: pull-request-main
on:
pull_request:
branches:
- main
types: [opened, edited, synchronize]
jobs:
label:
runs-on: ubuntu-latest
if: ${{github.event.action != 'synchronize'}}
steps:
- uses: bcoe/conventional-release-labels@v1
with:
type_labels: '{"feat": "feature", "fix": "fix", "breaking": "breaking","ci":"ci","docs":"docs"}'
build:
runs-on: ubuntu-latest
if: ${{github.event.action != 'edited'}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
#- run: yarn test
- run: yarn
- run: yarn build
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
docker:
runs-on: ubuntu-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'deploy')
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Computing Docker image tags
id: step1
env:
COMMIT_SHA: ${{github.event.pull_request.head.sha}}
run: |
OUT=$GITHUB_REPOSITORY:pull-${COMMIT_SHA::8}
OUT=$(echo "$OUT" | awk '{print tolower($0)}')
echo "docker_tags=$OUT" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
context: .
tags: ${{ steps.step1.outputs.docker_tags }}
file: Dockerfile