Skip to content

Commit b29fc9f

Browse files
committed
duplicate gh actions into prod/staging
1 parent a47267e commit b29fc9f

2 files changed

Lines changed: 51 additions & 10 deletions

File tree

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
name: Create and publish a Docker image
1+
name: Publish to dockerhub and perform a deploy on cloud run
22

3-
# Configures this workflow to run every time a change is pushed to the branch called `release`.
4-
# on:
5-
# release:
6-
# types: [published]
73
on:
8-
push:
9-
branches: ["build"]
4+
release:
5+
types: [published]
106

11-
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
127
jobs:
138
build-and-push-image:
149
runs-on: ubuntu-latest
15-
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
10+
1611
permissions:
1712
contents: read
1813
packages: write
19-
id-token: "write"
14+
id-token: write
2015

2116
steps:
2217
- name: Checkout repository
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to dockerhub and perform a deploy on cloud run
2+
3+
on:
4+
push:
5+
branches: ["develop"]
6+
7+
jobs:
8+
build-and-push-image:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Login to Docker Hub
21+
uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
26+
- name: Build and push Docker image
27+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
28+
with:
29+
context: .
30+
push: true
31+
tags: vnguyen/openbeta-media-server:staging
32+
33+
- id: "auth"
34+
name: "Authenticate to Google Cloud"
35+
uses: "google-github-actions/auth@v1"
36+
with:
37+
credentials_json: "${{ secrets.GOOGLE_CLOUD_CREDENTIALS }}"
38+
39+
- id: "deploy"
40+
uses: "google-github-actions/deploy-cloudrun@v1"
41+
with:
42+
service: "staging-media-server"
43+
image: "vnguyen/openbeta-media-server:staging"
44+
45+
- name: "Use output"
46+
run: 'curl "${{ steps.deploy.outputs.url }}"'

0 commit comments

Comments
 (0)