-
Notifications
You must be signed in to change notification settings - Fork 14
82 lines (81 loc) · 2.73 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: "Generate Website Data"
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
outputs:
devcontainer: ${{ steps.filter.outputs.devcontainer }}
noncontainer: ${{ steps.filter.outputs.noncontainer }}
steps:
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
- name: List all changed files
id: filter
run: |
devcontainer=false
noncontainer=false
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
if [[ $file = .devcontainer* ]]; then
devcontainer=true
else
noncontainer=true
fi
done
echo "devcontainer=$devcontainer" >> $GITHUB_OUTPUT
echo "noncontainer=$noncontainer" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build dev container
if: (steps.filter.outputs.devcontainer == 'true') && (github.event_name == 'push')
run: |
docker build --no-cache --tag ghcr.io/caciviclab/disclosure-backend-static/${{github.ref_name}}:latest -f ./.devcontainer/Dockerfile .
docker push ghcr.io/caciviclab/disclosure-backend-static/${{github.ref_name}}:latest
- name: Check code changes
if: steps.filter.outputs.noncontainer == 'true'
run: |
echo "TODO: run test to verify that code changes are good"
generate:
needs: build
if: (needs.build.outputs.noncontainer == 'true') || (github.event_name != 'push')
runs-on: ubuntu-latest
container:
image: ghcr.io/caciviclab/disclosure-backend-static/${{github.ref_name}}:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
env:
REPO_OWNER: ${{ github.repository_owner}}
REPO_BRANCH: ${{ github.ref_name }}
SERVICE_ACCOUNT_KEY_JSON: ${{ secrets.SERVICE_ACCOUNT_KEY_JSON }}
GDRIVE_FOLDER: ${{ vars.GDRIVE_FOLDER }}
PGHOST: postgres
PGDATABASE: disclosure-backend
PGUSER: app_user
PGPASSWORD: app_password
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: app_user
POSTGRES_DB: disclosure-backend
POSTGRES_PASSWORD: app_password
steps:
- uses: actions/checkout@v3
- name: Check setup
run: psql -l
- name: Create csv files
run: |
make download
make import
make process
# move the following up to download section when it's working
python download/main.py