-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (75 loc) · 2.3 KB
/
cd-workflow.yaml
File metadata and controls
77 lines (75 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
name: Deploy backstage
on:
workflow_dispatch:
push:
branches:
- main
jobs:
create-and-push-image:
permissions:
id-token: write
contents: read
name: "Create and push the Docker image to GAR"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'setup-qemu'
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- id: 'docker-buildx-setup'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
create_credentials_file: true
token_format: access_token
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/deploy-backstage/providers/github-actions'
service_account: 'deploy-backstage@code-idp.iam.gserviceaccount.com'
- id: 'login-gar'
name: "Login to GAR"
uses: docker/login-action@v3
with:
registry: europe-west10-docker.pkg.dev/code-idp/backstage-deploy
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- id: 'build-and-push'
name: 'Build and Push docker Image'
uses: docker/build-push-action@v5
with:
push: true
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: europe-west10-docker.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}
build-args: |
APP_ENV=docker
deploy-image:
permissions:
id-token: write
contents: read
name: "Deploy image on cloud run"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: create-and-push-image
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
create_credentials_file: true
with:
service: 'backstage-deployment'
image: 'europe-west10-docker.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}'
region: europe-west10
flags: |
--port=7007