Skip to content

fix(resource-adm): Fix misleading "Sist endret" field in resources table #109

fix(resource-adm): Fix misleading "Sist endret" field in resources table

fix(resource-adm): Fix misleading "Sist endret" field in resources table #109

name: Verify Quartz migrations
on:
push:
branches: [ main ]
paths:
- 'backend/packagegroups/NuGet.props'
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened]
paths:
- 'backend/**'
workflow_dispatch:
jobs:
check-quartz-update:
name: Check Quartz update
runs-on: ubuntu-latest
env:
tables-file: backend/src/Designer/Migrations/SqlScripts/QuartzTables/tables_postgres.sql
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if quartz library is updated
id: check-quartz-update
env:
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
diff=$(git diff --unified=0 origin/$BASE_REF...origin/$HEAD_REF -- backend/packagegroups/NuGet.props | grep + | grep Quartz | grep Version || true)
if [ -n "$diff" ]; then
echo "is-updated=true" >> $GITHUB_OUTPUT
else
echo "is-updated=false" >> $GITHUB_OUTPUT
fi
- name: Get the new quartz version
id: get-quartz-version
env:
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
if: steps.check-quartz-update.outputs.is-updated == 'true'
run: |
version=$(git diff --unified=0 origin/$BASE_REF...origin/$HEAD_REF -- backend/packagegroups/NuGet.props | grep \"Quartz\" | grep Version | grep + | sed -n 's/.*Version="\([^"]*\)".*/\1/p')
echo "quartz-version=$version" >> $GITHUB_OUTPUT
- name: Verify tables sql is not updated
id: check-tables-update
if: steps.check-quartz-update.outputs.is-updated == 'true'
run: |
download_url=$(curl https://api.github.com/repos/quartznet/quartznet/releases/tags/v${{ steps.get-quartz-version.outputs.quartz-version }} | \
jq -r '.assets[] | select(.name | contains("Quartz.NET-${{ steps.get-quartz-version.outputs.quartz-version }}.zip")) | .browser_download_url')
mkdir qdwn
curl -L -o qdwn/quartz.zip $download_url && unzip qdwn/quartz.zip -d qdwn && rm qdwn/quartz.zip
diff_output=$(diff -b ${{ env.tables-file }} qdwn/database/tables/tables_postgres.sql || true)
if [ -n "$diff_output" ]; then
echo "Quartz version that you are trying to update to requires new database migration scripts."
echo "Please add a new migration and edit the tables-file environment variable in the workflow file."
echo $diff_output
exit 1;
else
echo "Tables file is up to date"
fi