[Class statistics] Big refactor: Credit distribution development #1261
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: 'Test and release to staging' | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/test.yaml' | |
- '.github/workflows/staging.yaml' | |
- '.github/actions/**' | |
- 'cypress/**' | |
- 'cypress.config.json' | |
- 'services/**' | |
- '!services/backend/src/rapodiff/**' | |
- 'docker-compose.ci.yml' | |
- 'package*.json' | |
- 'updater/sis-updater-worker/src/db/migrations/**' | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yaml | |
secrets: | |
username: ${{ secrets.TOSKAREGISTRY_USERNAME }} | |
password: ${{ secrets.TOSKAREGISTRY_PASSWORD }} | |
release_frontend: | |
name: 'Build and release frontend' | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get current time | |
id: get_current_time | |
run: echo "NOW=$(date --iso-8601=seconds)" >> $GITHUB_OUTPUT | |
- name: Build frontend image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: oodikone-frontend | |
tags: staging ${{ github.sha }} | |
context: services | |
containerfiles: | | |
services/frontend/Dockerfile | |
build-args: | | |
BUILT_AT=${{ steps.get_current_time.outputs.NOW }} | |
BASE_PATH=/oodikone | |
STAGING=true | |
- 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 | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build backend image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: oodikone-backend | |
tags: staging ${{ github.sha }} | |
context: services | |
containerfiles: | | |
services/backend/Dockerfile | |
build-args: | | |
BASE_PATH=/oodikone | |
GIT_SHA=${{ github.sha }} | |
STAGING=true | |
- 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 }} | |
report_success: | |
name: 'Report deployment success to oodikone notifications' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
- 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://toska-staging.cs.helsinki.fi/oodikone | |
deployment-target: staging | |
report_failure: | |
name: 'Report deployment failure to oodikone notifications' | |
runs-on: ubuntu-latest | |
needs: | |
- release_frontend | |
- 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: staging |