Debian Codegraph @

.github/workflows/db-migrations.yml

raw
1 # Copyright 2023 The Archivista Contributors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 name: db-migrations
16 on:
17 push:
18 tags:
19 - v*
20 branches:
21 - master
22 - main
23 pull_request:
24 paths:
25 - 'ent/**'
26 - 'ent.*'
27 - '.github/workflows/db-migrations.yml'
28 workflow_dispatch:
29
30 permissions:
31 contents: read
32 pull-requests: read
33
34 jobs:
35 db-migrations:
36 name: db-migrations
37 runs-on: ubuntu-latest
38 steps:
39 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
40
41 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
42 with:
43 go-version-file: "go.mod"
44
45 - name: Check DB Migrations
46 run: |
47 curl -sSf https://atlasgo.sh | sh
48 before=$(find ent/migrate/migrations/ -type f | wc -l | awk '{ print $1 }')
49 make db-migrations
50 after=$(find ent/migrate/migrations/ -type f | wc -l | awk '{ print $1 }')
51 if [[ $before -lt $after ]]; then echo "missing 'make db-migrations'"; exit 1; fi