Skip to content

Commit ead2e3f

Browse files
committed
Add a workflow file to deploy to cloud run
1 parent 8f7233b commit ead2e3f

3 files changed

Lines changed: 65 additions & 6 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: deploy-artifact
2+
on:
3+
push:
4+
5+
jobs:
6+
docker-release:
7+
name: Tagged Docker release to Google Artifact Registry
8+
runs-on: ubuntu-latest
9+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') # only run when a tagged commit is pushed
10+
11+
permissions:
12+
contents: 'read'
13+
id-token: 'write'
14+
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
19+
- id: 'auth'
20+
name: 'Authenticate to Google Cloud'
21+
uses: 'google-github-actions/auth@v2'
22+
with:
23+
token_format: access_token
24+
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
25+
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
26+
access_token_lifetime: 300s
27+
28+
- name: Login to Artifact Registry
29+
uses: docker/login-action@v1
30+
with:
31+
registry: us-central1-docker.pkg.dev
32+
username: oauth2accesstoken
33+
password: ${{ steps.auth.outputs.access_token }}
34+
35+
- name: Get tag
36+
id: get-tag
37+
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: .
43+
push: true
44+
tags: |
45+
us-central1-docker.pkg.dev/adventures-in-tech-world-0/tech-world-game-server-repo/tech-world-game-server-image:${{ steps.get-tag.outputs.short_ref }}
46+
us-central1-docker.pkg.dev/adventures-in-tech-world-0/tech-world-game-server-repo/tech-world-game-server-image:latest
47+
48+
- name: Deploy container image to Cloud Run
49+
id: 'deploy'
50+
uses: 'google-github-actions/deploy-cloudrun@v2'
51+
with:
52+
service: tech-world-game-server-service
53+
image: us-central1-docker.pkg.dev/adventures-in-tech-world-0/tech-world-game-server-repo/tech-world-game-server-image:latest
54+
55+
- name: 'Show url'
56+
run: 'echo "${{ steps.deploy.outputs.url }}"'

pubspec.lock

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,12 @@ packages:
305305
tech_world_networking_types:
306306
dependency: "direct main"
307307
description:
308-
path: "../../interfaces/tech_world_networking_types"
309-
relative: true
310-
source: path
311-
version: "0.0.0-1"
308+
path: "."
309+
ref: HEAD
310+
resolved-ref: "25e4fd272fdf40ed7fac6d0bd4ccf1f79abdf9da"
311+
url: "https://github.com/enspyrco/tech_world_networking_types"
312+
source: git
313+
version: "0.0.0+1"
312314
term_glyph:
313315
dependency: transitive
314316
description:

pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: tech_world_game_server
22
description: A shelf_web_socket server for tech_world.
33
version: 1.0.0+1
44
publish_to: none
5-
# repository: https://github.com/my_org/my_repo
5+
repository: https://github.com/enspyrco/tech_world_game_server
66

77
environment:
88
sdk: ^3.0.0
@@ -12,7 +12,8 @@ dependencies:
1212
shelf_web_socket: ^2.0.0
1313
web_socket_channel: ^3.0.0
1414
tech_world_networking_types:
15-
path: ../../interfaces/tech_world_networking_types
15+
# path: ../../interfaces/tech_world_networking_types
16+
git: https://github.com/enspyrco/tech_world_networking_types
1617

1718
dev_dependencies:
1819
lints: ^4.0.0

0 commit comments

Comments
 (0)