-
Notifications
You must be signed in to change notification settings - Fork 10
61 lines (52 loc) · 1.59 KB
/
deploy.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
name: 'Deploy'
on:
push:
branches:
- dev
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Set image tag'
id: tag
run: |
IMAGE_TAG="0.0.0"
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
REF=${{ github.ref }};
TAG_FULL=${REF#refs/*/};
IMAGE_TAG=${TAG_FULL//\//_};
fi
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v2
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v2
- name: 'Login to GHCR'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: 'Build and push'
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/flipperdevices/flpr.app:${{steps.tag.outputs.image_tag}}
- name: 'Image digest'
run: |
echo ${{ steps.docker_build.outputs.digest }}
- name: 'Trigger k8s to use new image'
uses: peter-evans/repository-dispatch@v2
with:
repository: ${{ secrets.INFRASTRUCTURE_REPO }}
token: ${{ secrets.K8S_GITHUB_PAT }}
event-type: flpr-app-deploy
client-payload: '{"image_tag": "${{steps.tag.outputs.image_tag}}"}'