This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (69 loc) · 2.15 KB
/
build-deploy.yaml
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
name: Build
on:
workflow_dispatch:
push:
branches:
- beta
- dev
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
IMAGE_TAG: ${{ github.sha }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Cred
shell: bash
env:
NETRC_CONFIG: ${{ secrets.NETRC_CONFIG }}
run: |
echo "$NETRC_CONFIG" >> /home/runner/.netrc
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }},${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
secret-files: |
"netrcConf=/home/runner/.netrc"
deploy:
name: Deploy to deploys.app
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: deploys-app/deploys-action@v1
with:
project: rpkm66
location: gke.cluster-rcf2
name: rpkm66-gateway-${{ steps.extract_branch.outputs.branch }}
image: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
env:
DEPLOYS_AUTH_USER: ${{ secrets.DEPLOYS_AUTH_USER }}
DEPLOYS_AUTH_PASS: ${{ secrets.DEPLOYS_AUTH_PASS }}