Skip to content

Commit

Permalink
duplicate gh actions into prod/staging
Browse files Browse the repository at this point in the history
  • Loading branch information
enapupe committed Nov 2, 2023
1 parent a47267e commit b29fc9f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 10 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/docker.yml → .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
name: Create and publish a Docker image
name: Publish to dockerhub and perform a deploy on cloud run

# Configures this workflow to run every time a change is pushed to the branch called `release`.
# on:
# release:
# types: [published]
on:
push:
branches: ["build"]
release:
types: [published]

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.

permissions:
contents: read
packages: write
id-token: "write"
id-token: write

steps:
- name: Checkout repository
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish to dockerhub and perform a deploy on cloud run

on:
push:
branches: ["develop"]

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: vnguyen/openbeta-media-server:staging

- id: "auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_CLOUD_CREDENTIALS }}"

- id: "deploy"
uses: "google-github-actions/deploy-cloudrun@v1"
with:
service: "staging-media-server"
image: "vnguyen/openbeta-media-server:staging"

- name: "Use output"
run: 'curl "${{ steps.deploy.outputs.url }}"'

0 comments on commit b29fc9f

Please sign in to comment.