Skip to content

Merge pull request #751 from UniversityOfHelsinkiCS/renovate/npm-node… #206

Merge pull request #751 from UniversityOfHelsinkiCS/renovate/npm-node…

Merge pull request #751 from UniversityOfHelsinkiCS/renovate/npm-node… #206

Workflow file for this run

name: Build, test and release production
on:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.17
- name: Install eslint
run: npm install eslint
- name: Run lint
run: npm run lint
build-and-test:
runs-on: ubuntu-20.04
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test
run: npm run test
publish:
runs-on: ubuntu-latest
needs: [lint, build-and-test]
steps:
- uses: actions/checkout@v3
- name: Build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: suoritustarkistin
tags: production ${{ github.sha }}
containerfiles: |
./Dockerfile
build-args: |
BASE_PATH=/suoritustarkistin/
NODE_ENV=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:
runs-on: ubuntu-latest
needs: publish
if: success()
steps:
- uses: actions/checkout@v3
- name: Pull image and create a container
run: docker create --name suotar quay.io/toska/suoritustarkistin:production
- name: Copy assets from the container
run: docker cp suotar:/opt/app-root/src ./app
- 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: suotar
with:
environment: production
set_commits: 'skip'
sourcemaps: ./app
url_prefix: '~/app'
report_success:
name: 'Report deployment success to Suotar-channel'
runs-on: ubuntu-latest
needs:
- lint
- build-and-test
- publish
- sentry-release
if: success()
steps:
- name: 'Send notification to Slack'
uses: UniversityOfHelsinkiCS/[email protected]
with:
webhook-url: ${{ secrets.SLACKBOT_URL }}
message-type: deployment
softa-url: https://opetushallinto.cs.helsinki.fi/suoritustarkistin/
deployment-target: production
report_failure:
name: 'Report deployment failure to Suotar-channel'
runs-on: ubuntu-latest
needs:
- lint
- build-and-test
- publish
if: failure()
steps:
- name: 'Send notification to Slack'
uses: UniversityOfHelsinkiCS/[email protected]
with:
webhook-url: ${{ secrets.SLACKBOT_URL }}
message-type: deployment-failure