π Try to fix precommit #988
Workflow file for this run
This file contains hidden or 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: Docker Image Workflow | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-linux: | |
| defaults: | |
| run: | |
| # Ensures environment gets sourced right | |
| shell: bash -e -l {0} | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Host Dependencies | |
| # We need to match postgresql version with tools found in this runner :/ | |
| run: | | |
| sudo rm /etc/apt/sources.list.d/pgdg.list || true | |
| echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list | |
| wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
| sudo apt-get -qq update || true | |
| sudo apt-get -qq install -y --no-install-suggests --no-install-recommends postgresql-client-18 python3-pip | |
| pip3 install psycopg | |
| python3 -c "import psycopg; print(psycopg.__version__)" | |
| - name: Run Docker build script | |
| run: sh build_docker_image.sh | |
| # - name: Setup upterm session | |
| # if: ${{ failure() }} | |
| # uses: lhotari/action-upterm@v1 | |
| # with: | |
| # limit-access-to-actor: true | |
| - name: Publish to Github Container Registry | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| env: | |
| CR_PAT: ${{ secrets.CR_PAT }} | |
| run: | | |
| echo $CR_PAT | docker login ghcr.io -u akrherz --password-stdin | |
| docker push ghcr.io/akrherz/iem_database:test_data | |
| docker push ghcr.io/akrherz/iem_database:no_test_data | |
| - name: Clean up old container images | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/delete-package-versions@v5 | |
| with: | |
| token: ${{ secrets.CR_PAT }} | |
| package-name: 'iem_database' | |
| package-type: 'container' | |
| min-versions-to-keep: 10 | |
| delete-only-untagged-versions: true |