fix: drop processed column if it exists #482
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: Deploy to Staging | |
concurrency: deploy_to_staging | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
STAGING_ID: cc67ac7f-d41b-4a9c-a2ce-37f322690cb8 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Update the project version | |
run: | | |
OLD_VERSION=$(python -c 'import version; print(version.version)') | |
pip install python-semantic-release==9.4.1 && python -m semantic_release version --no-changelog | |
NEW_VERSION=$(python -c 'import version; print(version.version)') | |
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then | |
echo "No new version generated, can't deploy" | |
exit 1 | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Build the Docker image | |
run: | | |
export VERSION=$(python -c 'import version; print(version.version)') | |
docker build . --file Dockerfile \ | |
--build-arg DJANGO_SETTINGS_MODULE=apps.common.settings.production \ | |
--tag registry.digitalocean.com/openunited/core:$VERSION | |
- name: Login to registry | |
run: doctl registry login --expiry-seconds 600 | |
- name: Push to DigitalOcean | |
run: docker push -a registry.digitalocean.com/openunited/core | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- run: pip install yq | |
- name: Fetch current spec file | |
run: doctl apps spec get $STAGING_ID > spec.yaml | |
- name: Update image tag | |
run: | | |
export VERSION=$(python -c 'import version; print(version.version)') | |
python -m yq -Y --indentless --arg TAG "$VERSION" '.services[].image.tag = $TAG' spec.yaml > tmp.yaml && mv tmp.yaml spec.yaml | |
python -m yq -Y --indentless --arg TAG "$VERSION" '.workers[].image.tag = $TAG' spec.yaml > tmp.yaml && mv tmp.yaml spec.yaml | |
- name: Update the environment | |
run: doctl apps update $STAGING_ID --spec spec.yaml |