Skip to content

Commit

Permalink
fix(CI): fixes release ci (#166)
Browse files Browse the repository at this point in the history
Co-authored-by: Oli Parker <oliver.parker@gridedge.co.uk>
  • Loading branch information
ollz272 and ollz272 authored Apr 13, 2023
1 parent 63a7bab commit 72d75d9
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,41 @@ on:
jobs:
gcr-push:
name: Push to GCR
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout
if: needs.release.outputs.new_release_published == 'true'
uses: actions/checkout@v3
- name: Push to GCR
if: needs.release.outputs.new_release_published == 'true'
uses: RafikFarhad/push-to-gcr-github-action@v5-beta
with:
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
registry: gcr.io
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
image_name: ${{ secrets.GCLOUD_IMAGE_NAME }}
image_tag: latest,${{ needs.release.outputs.new_release_version }}
image_tag: latest,${{ github.event.release.tag_name }}
dockerfile: ./Dockerfile

migrate:
name: Migrate Database
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout
if: needs.release.outputs.new_release_published == 'true'
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
if: needs.release.outputs.new_release_published == 'true'
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
if: needs.release.outputs.new_release_published == 'true'
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
if: needs.release.outputs.new_release_published == 'true'
run: |
poetry install
- name: Migrate
if: needs.release.outputs.new_release_published == 'true'
run: poetry run ./manage.py migrate --settings="project.settings.production"
env:
DJANGO_DATABASE_NAME: ${{ secrets.DJANGO_DATABASE_NAME }}
Expand All @@ -62,20 +54,17 @@ jobs:

deploy:
runs-on: ubuntu-latest
needs: [release, migrate, gcr-push]
needs: [migrate, gcr-push]
steps:
- name: Checkout
if: needs.release.outputs.new_release_published == 'true'
uses: actions/checkout@v3
- id: auth
if: needs.release.outputs.new_release_published == 'true'
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }}

- id: deploy
if: needs.release.outputs.new_release_published == 'true'
name: Deploy to GCR
uses: google-github-actions/deploy-cloudrun@v1
with:
Expand Down

0 comments on commit 72d75d9

Please sign in to comment.