University view fixed #236
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Release to production' | |
on: | |
release: | |
types: [published] | |
jobs: | |
release_frontend: | |
name: 'Build and release frontend' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Get current time' | |
id: get_current_time | |
run: echo "NOW=$(date --iso-8601=seconds)" >> $GITHUB_OUTPUT | |
- name: Extract release version | |
id: extract_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Build frontend image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: oodikone-frontend | |
tags: production ${{ github.sha }} | |
context: services | |
containerfiles: | | |
services/frontend/Dockerfile | |
build-args: | | |
BUILT_AT=${{ steps.get_current_time.outputs.NOW }} | |
SENTRY_RELEASE=${{ steps.extract_version.outputs.VERSION }} | |
SENTRY_ENVIRONMENT=production | |
SENTRY_DSN=${{ secrets.OODIKONE_FRONTEND_SENTRY_DSN }} | |
- name: Push to quay.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: quay.io/toska | |
username: toska+github | |
password: ${{ secrets.QUAY_IO_TOKEN }} | |
release_backend: | |
name: 'Build and release backend' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract release version | |
id: extract_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Build backend image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: oodikone-backend | |
tags: production ${{ github.sha }} | |
context: services | |
containerfiles: | | |
services/backend/Dockerfile | |
build-args: | | |
SENTRY_RELEASE=${{ steps.extract_version.outputs.VERSION }} | |
SENTRY_ENVIRONMENT=production | |
- name: Push to quay.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: quay.io/toska | |
username: toska+github | |
password: ${{ secrets.QUAY_IO_TOKEN }} | |
sentry_release_frontend: | |
name: 'Create Sentry release for frontend' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
- release_backend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract release version | |
id: extract_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Pull frontend image and create a container | |
run: docker create --name frontend quay.io/toska/oodikone-frontend:production | |
- name: Copy assets from the frontend container | |
run: docker cp frontend:/opt/app-root/src/build ./build | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_URL: https://toska.cs.helsinki.fi/ | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }} | |
SENTRY_ORG: toska | |
SENTRY_PROJECT: oodikone-frontend | |
with: | |
environment: production | |
set_commits: 'skip' | |
sourcemaps: './build/assets' | |
url_prefix: '~/assets' | |
version: ${{ steps.extract_version.outputs.VERSION }} | |
sentry_release_backend: | |
name: 'Create Sentry release for backend' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
- release_backend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract release version | |
id: extract_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Pull backend image and create a container | |
run: docker create --name backend quay.io/toska/oodikone-backend:production | |
- name: Copy assets from the backend container | |
run: docker cp backend:/opt/app-root/src/dist ./dist | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_URL: https://toska.cs.helsinki.fi/ | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }} | |
SENTRY_ORG: toska | |
SENTRY_PROJECT: oodikone-backend | |
with: | |
environment: production | |
set_commits: 'skip' | |
sourcemaps: './dist' | |
url_prefix: '~/opt/app-root/src/dist/' | |
version: ${{ steps.extract_version.outputs.VERSION }} | |
report_success: | |
name: 'Report deployment success to oodikone notifications' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
- release_backend | |
- sentry_release_frontend | |
- sentry_release_backend | |
if: success() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Send notification to slack' | |
uses: UniversityOfHelsinkiCS/slackbot-action@v1.5 | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
message-type: deployment | |
softa-url: https://oodikone.cs.helsinki.fi/ | |
deployment-target: production | |
report_failure: | |
name: 'Report deployment failure to oodikone notifications' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
- release_backend | |
- sentry_release_frontend | |
- sentry_release_backend | |
if: failure() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Send notification to slack' | |
uses: UniversityOfHelsinkiCS/slackbot-action@v1.5 | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
message-type: deployment-failure | |
deployment-target: production |