-
-
Notifications
You must be signed in to change notification settings - Fork 64
86 lines (75 loc) · 2.15 KB
/
dockerimage-pr.yml
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
name: Pull Request
concurrency:
group: pr-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
pull_request
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # load full history
- name: Get short SHA
id: slug
run: echo "SHA=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
- name: install node LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
check-latest: true
- name: Build a bot
env:
OPENEXCHANGE_APPID: ${{ secrets.OPENEXCHANGE_APPID }}
NODE_MODULES_DIR: ./node_modules
run: make
- name: Add commit file
run: echo "$(echo ${GITHUB_SHA} | cut -c1-8)" >> ./.commit
- name: Zip a bot
run: make pack
- name: Zip node_modules
run: make pack-modules
- uses: actions/upload-artifact@v3
with:
name: sogeBot-${{ steps.slug.outputs.SHA }}
path: ${{ github.workspace }}/*.zip
build:
needs: artifact
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Get short SHA
id: slug
run: echo "SHA=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
-
name: Set up QEMU
uses: docker/[email protected]
-
name: Set up Docker Buildx
uses: docker/[email protected]
-
name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- uses: actions/download-artifact@v3
with:
name: sogeBot-${{ steps.slug.outputs.SHA }}
path: ${{ github.workspace }}/*.zip
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
tags: |
sogebot/pr:${{github.head_ref}}
cache-from: type=gha
cache-to: type=gha,mode=max