forked from jamesjUVA/VCEapp
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (79 loc) · 2.45 KB
/
main.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
name: VCEapp Build CI
on:
push:
tags: ['*.*']
# branches:
# - 'master'
# - 'main'
env:
REGISTRY: ghcr.io
IMAGE_NAME: uvarc/vce-app
# IMAGE_TAG: 1.${{ github.run_number }} # GITHUB_RUN_NUMBER }}
SVC_NAME: vceApp
jobs:
Build-Docker:
# Pushes a :latest image to Docker Hub
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Docker
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: uvarc/vce-app:latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Build-GHCR:
# Builds and pushes a tagged release to GHCR, then deploys to k8s
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set ENV
run: echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: echo VAR
run: |
echo ${{ env.IMAGE_TAG }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_PAT }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Remote Dispatch
run: |
curl -X POST https://api.github.com/repos/uvarc/jablonski/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-H "Authorization: token ${{ secrets.GHCR_PAT }}" \
--data '{"event_type": "${{ env.IMAGE_NAME }} update to ${{ env.IMAGE_TAG }}", "client_payload": { "service": "${{ env.SVC_NAME }}", "version": "${{ env.IMAGE_TAG }}" }}'