Skip to content

Commit

Permalink
Remove old GitHub workflows and update tests workflow
Browse files Browse the repository at this point in the history
Old GitHub workflows related to production, docker, migration, and old tests were removed. Updated tests workflow to include checkout, docker metadata, authentication, GAR login, and build-push steps. The environment has been updated to include conditions for production or development deployment based on the event reference.
  • Loading branch information
bgharbi-globalpos committed Feb 8, 2024
1 parent 0890ca0 commit 8ccf5e8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 196 deletions.
67 changes: 0 additions & 67 deletions .github/workflows/cicd-prod.yml

This file was deleted.

61 changes: 14 additions & 47 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ name: gol2

on:
push:
tags:
- v*
branches:
- 'dev'
- 'update-starknet'
workflow_dispatch:

env:
GAR: europe-west9-docker.pkg.dev
Project: gol2-indexer
GCP_Project_ID: ${{ startsWith(github.event.ref, 'refs/tags/v') && 'gol2-production' || 'gol2-development' }}
jobs:
Build:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.meta.outputs.tags }}
tag: ${{ steps.meta.outputs.version }}
environment:
name: ${{ startsWith(github.event.ref, 'refs/tags/v') && 'production' || 'development' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -20,23 +27,24 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: europe-west9-docker.pkg.dev/gol2-development/gol2/dev
images: ${{ env.GAR }}/${{ env.GCP_Project_ID }}/${{ env.Project }}/${{ github.head_ref && 'feature' || startsWith(github.event.ref, 'refs/tags/v') && github.event.repository.default_branch || github.ref_name }}
flavor: latest=false
tags: |
type=ref,suffix=-{{sha}},event=branch
type=sha,event=branch
type=ref,suffix=-{{sha}},event=pr
type=ref,event=tag
- uses: 'google-github-actions/auth@v2'
id: auth
with:
token_format: access_token
project_id: 'gol2-development'
project_id: ${{ env.Project }}
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'

- name: Login to GAR
uses: docker/login-action@v3
with:
registry: europe-west9-docker.pkg.dev
registry: ${{ env.GAR }}
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

Expand All @@ -47,44 +55,3 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Deploy-dev:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/dev'
needs: Build
runs-on: ubuntu-latest
env:
image: ${{ needs.Build.outputs.image }}
steps:
- uses: 'google-github-actions/auth@v2'
id: auth
with:
token_format: access_token
project_id: 'gol2-development'
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'

- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v2
with:
service: gol2
image: ${{ env.image }}
region: europe-west9
Deploy-update:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/snapshot'
needs: Build
runs-on: ubuntu-latest
env:
image: ${{ needs.Build.outputs.image }}
steps:
- uses: 'google-github-actions/auth@v2'
id: auth
with:
token_format: access_token
project_id: 'gol2-development'
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'

- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v2
with:
service: gol2-update
image: ${{ env.image }}
region: europe-west9
25 changes: 0 additions & 25 deletions .github/workflows/docker.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/miigration.yml

This file was deleted.

0 comments on commit 8ccf5e8

Please sign in to comment.