Skip to content

Commit

Permalink
Pass tags in between jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ronardcaktus committed Sep 19, 2024
1 parent 9c90c5b commit dd44bc4
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,25 @@ jobs:
id: docker-login
run: |
inv aws.docker-login
- name: Build, tag, push, and deploy image
- name: Build, tag, and push image
id: build-tag-push
run: |
[ "$GITHUB_REF" = refs/heads/main ] &&
ENV="production" ||
ENV="staging"
echo "env is $ENV"
inv $ENV image.push
- uses: act10ns/slack@v1
- shell: bash
run: |
inv image.tag | grep 'Set config.tag to' | cut -d' ' -f4 > docker-tag.txt
- name: Upload docker tag from build-push job
uses: actions/upload-artifact@v4
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
# always() means to notify regardless of status
if: always()
name: docker_tag
path: docker-tag.txt

# The deploy needs to run from within the cluster, since the cluster
# is not exposed to the public internet
deploy:
runs-on: arc-runner-set # K8s self-hosted runner
needs: [build-push]
Expand All @@ -57,6 +62,14 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v3
- name: Download docker tag from build-push job
uses: actions/download-artifact@v4
with:
name: docker_tag
- name: Set variables
run: |
DOCKER_TAG=$(cat docker-tag.txt)
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand All @@ -67,3 +80,17 @@ jobs:
run: |
python -m pip install --upgrade pip wheel pip-tools
pip-sync requirements/dev/dev.txt
- name: Deploy the image
id: deploy
run: |
[ "$GITHUB_REF" = refs/heads/main ] &&
ENV="production" ||
ENV="staging"
echo "env is $ENV"
inv $ENV deploy --tag=${{ env.DOCKER_TAG }}
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
# always() means to notify regardless of status
if: always()

0 comments on commit dd44bc4

Please sign in to comment.