Internal: Fix 'show as user' functionality #177
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/frontend | |
containerfiles: | | |
services/frontend/Dockerfile | |
build-args: | | |
BUILT_AT=${{ steps.get_current_time.outputs.NOW }} | |
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 }} | |
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/backend | |
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: | |
name: 'Create Sentry release' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract release version | |
id: extract_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Pull image and create a container | |
run: docker create --name frontend quay.io/toska/oodikone-frontend:production | |
- name: Copy assets from the 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 | |
with: | |
environment: production | |
set_commits: 'skip' | |
sourcemaps: './build/assets' | |
url_prefix: '~/assets' | |
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 | |
if: success() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Send notification to slack' | |
uses: UniversityOfHelsinkiCS/[email protected] | |
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 | |
if: failure() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Send notification to slack' | |
uses: UniversityOfHelsinkiCS/[email protected] | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
message-type: deployment-failure | |
deployment-target: production |