Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
environment:
type: environment
description: The environment to deploy to.
digital_land_python_ref:
type: string
description: digital-land-python git ref to build against (branch, tag, or SHA).
default: main

jobs:
test:
Expand Down Expand Up @@ -40,6 +44,14 @@ jobs:
env:
DOCKER_REPO: ${{ secrets.DEPLOY_DOCKER_REPOSITORY }}
steps:
- name: Block feature refs in production
run: |
REF="${{ inputs.digital_land_python_ref || 'main' }}"
if [ "$REF" != "main" ] && [ "${{ matrix.environment }}" == "production" ]; then
echo "::error::Refusing to deploy digital-land-python ref '$REF' to '${{ matrix.environment }}' — feature refs are not allowed in production."
exit 1
fi

- uses: actions/checkout@v6

- id: vars
Expand All @@ -64,7 +76,7 @@ jobs:

- run: docker pull $DOCKER_REPO:${GITHUB_REF_NAME} || echo "no current latest image"

- run: docker build --build-arg DEPLOY_TIME="$(date +%Y-%m-%dT%H:%M:%S)" --build-arg GIT_COMMIT="${{ steps.vars.outputs.sha_short }}" -t $DOCKER_REPO:${{ steps.vars.outputs.sha_short }} -f ./Dockerfile .
- run: docker build --build-arg DIGITAL_LAND_PYTHON_REF="${{ inputs.digital_land_python_ref || 'main' }}" --build-arg DEPLOY_TIME="$(date +%Y-%m-%dT%H:%M:%S)" --build-arg GIT_COMMIT="${{ steps.vars.outputs.sha_short }}" -t $DOCKER_REPO:${{ steps.vars.outputs.sha_short }} -f ./Dockerfile .

- run: docker tag $DOCKER_REPO:${{ steps.vars.outputs.sha_short }} $DOCKER_REPO:main

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.8-slim-bookworm
ARG DIGITAL_LAND_PYTHON_REF=main
WORKDIR /
RUN apt-get update
RUN apt-get upgrade -y
Expand All @@ -17,6 +18,7 @@ RUN pip install pyproj
RUN pip install csvkit
RUN pip install awscli
RUN pip install --upgrade pip
RUN sed -i "s|pipeline.git@main|pipeline.git@${DIGITAL_LAND_PYTHON_REF}|" requirements.txt
RUN pip3 install --upgrade -r requirements.txt

CMD ["./bin/run.sh"]
Expand Down