Repository navigation
82 lines (72 loc) · 2.3 KB
/
Copy pathbuildimage.yml
File metadata and controls
82 lines (72 loc) · 2.3 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
name: build
on:
push:
branches:
- main
tags:
- 'v*.*.*'
jobs:
publish-image:
runs-on: ubuntu-latest
if: github.repository == 'solarperformanceinsight/solarperformanceinsight'
outputs:
imgdigest: ${{ steps.build.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: quay.io/solarperformanceinsight/solarperformanceinsight
tag-sha: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and push
id: build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
update-deployment:
runs-on: ubuntu-latest
if: github.repository == 'solarperformanceinsight/solarperformanceinsight'
needs:
- publish-image
steps:
- uses: actions/checkout@v2
with:
repository: solarperformanceinsight/spi-deploy
token: ${{ secrets.DEPLOY_TOKEN }}
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: 3.8.7
- name: Set ref
id: sharef
run: |
echo "::set-output name=ref::$(echo ${GITHUB_SHA} | cut -b -12)"
- name: Make PR
run: |
git config user.name spi-bot
git config user.email gh@solarperformanceinsight.org
git checkout -b deploy/${REF}
cd overlays/development/spi
kustomize edit set image ${IMG}@${DIGEST}
git add kustomization.yaml
git commit -m 'Update '${IMG}' built from '${REF}
git push origin deploy/${REF}
gh pr create --fill
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
REF: ${{ steps.sharef.outputs.ref }}
IMG: quay.io/solarperformanceinsight/solarperformanceinsight
DIGEST: ${{ needs.publish-image.outputs.imgdigest }}