remove misplaced 'if' in workflow #32
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
# This workflow will later be replaced with logic to "Generate Website Data" | |
# The verify-gdrive.yml workflow file will be renamed to this one | |
# We have to introduce this change in steps because GitHub gets confused until | |
# we add the new workflow file to the master branch | |
name: "Generate Website Data" | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
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' | |
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: | |
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 | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: app_user | |
POSTGRES_DB: "disclosure-backend" | |
POSTGRES_PASSWORD: app_password | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create csv files | |
run: | | |
make download | |
make import | |
python download/main.py | |