-
Notifications
You must be signed in to change notification settings - Fork 14
46 lines (43 loc) · 1.6 KB
/
branch.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
name: "Branch"
on:
push:
branches:
- "main"
concurrency:
# Cancel old runs if there is a new commit in the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
integration:
runs-on: ubuntu-latest
steps:
- name: Retrieve branch name
run: echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ github.job }}-${{ runner.os }}-${{ env.BRANCH }}-buildx
restore-keys: |
${{ github.job }}-${{ runner.os }}-${{ env.BRANCH }}-buildx
# Docker login
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
# Build and push docker image
- name: Build docker image
uses: docker/build-push-action@v4
with:
target: release
push: true
tags: peersyst/exrp:${{ env.BRANCH }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
if: always()
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache