feat(#87): 2024 updates #70
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
name: Generate and Persist Outputs | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
directory: | |
name: Define Output Directory | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Define | |
run: | | |
. cicd/export/scripts/create_directory.sh | |
echo $UNIQUE_DIR > unique.dir | |
echo $LOCAL_OUTPUT_DIR > local-output.dir | |
- name: Retain Directory Data | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dirs | |
path: '*.dir' | |
layouts: | |
name: Generate Layouts | |
needs: directory | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Retrieve Directory Data | |
uses: actions/download-artifact@v2 | |
with: | |
name: dirs | |
- name: Update Satellite Imagery | |
run: | | |
cicd/imagery/scripts/update-stadium.sh | |
- name: Read to Var | |
id: read_to_var | |
run: | | |
echo "::set-output name=UNIQUE_DIR::$(head -n 1 unique.dir)" | |
echo "::set-output name=LOCAL_OUTPUT_DIR::$(head -n 1 local-output.dir)" | |
- name: Create Output Directory | |
run: | | |
mkdir -p ${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }} | |
- name: Layout Generator | |
run: | | |
cicd/scripts/pull_or_build.sh repo=tomfumb image=qgis-exporter:2 build_dir=cicd/export/docker context_dir=cicd upload_if_missing=1 | |
docker run --rm -v $PWD:/code tomfumb/qgis-exporter:2 /code/cicd/export/docker/generate.sh output_base=/code/${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }} pdf=1 | |
- name: Retain Generated Layouts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: outputs | |
path: output | |
osm: | |
name: Export OSM Data | |
needs: directory | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Retrieve Directory Data | |
uses: actions/download-artifact@v2 | |
with: | |
name: dirs | |
- name: Read to Var | |
id: read_to_var | |
run: | | |
echo "::set-output name=LOCAL_OUTPUT_DIR::$(head -n 1 local-output.dir)" | |
- name: Create Output Directory | |
run: | | |
mkdir -p ${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }}/main | |
- name: Export OSM XML | |
run: | | |
cicd/osm/scripts/export.sh local_output_dir=${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }} | |
- name: Render OSM | |
run: | | |
cicd/osm/scripts/render.sh local_output_dir=${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }} | |
- name: Retain OSM Data | |
uses: actions/upload-artifact@v2 | |
with: | |
name: osm | |
path: ${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }}/main/bvnordic.osm* | |
upload: | |
name: Upload | |
needs: [layouts, osm] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Retrieve Directory Data | |
uses: actions/download-artifact@v2 | |
with: | |
name: dirs | |
- name: Clear Conflicting Dir | |
run: | | |
sudo rm -rf output | |
- name: Retrieve Generated Layouts | |
uses: actions/download-artifact@v2 | |
with: | |
name: outputs | |
path: output | |
- name: Retrieve OSM | |
uses: actions/download-artifact@v2 | |
with: | |
name: osm | |
- name: Read to Var | |
id: read_to_var | |
run: | | |
echo "::set-output name=LOCAL_OUTPUT_DIR::$(head -n 1 local-output.dir)" | |
echo "::set-output name=UNIQUE_DIR::$(head -n 1 unique.dir)" | |
- name: Move OSM | |
run: | | |
mv bvnordic.osm* ${{ steps.read_to_var.outputs.LOCAL_OUTPUT_DIR }}/main | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Python Dependencies (upload) | |
run: | | |
pip install -r cicd/upload/requirements.txt | |
- name: Upload to Google Drive | |
run: | | |
python -m cicd.upload.upload ${{ steps.read_to_var.outputs.UNIQUE_DIR }} $PWD/output --update_latest | |
env: | |
GDRIVE_UPLOAD_SERVICE_ACCT_INFO: ${{ secrets.GDRIVE_CI_UPLOAD_SERVICE_ACCT_INFO }} |