Fix the directive location to be nested so that it inherits parent di… #839
Workflow file for this run
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: Docker | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
- staging | |
# Run tests for any PRs. | |
pull_request: | |
jobs: | |
# Run tests. | |
test: | |
# Ensure latest python image is mirrored before running tests. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and Start Images | |
run: | | |
cp template.env .env | |
docker compose up -d --build | |
- name: Run tests | |
run: | | |
docker compose exec -T externallinks /app/bin/django_wait_for_db.sh python django_wait_for_migrations.py test | |
# Push images to quay.io/wikipedialibrary. | |
push: | |
# Ensure test job passes before pushing images. | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log into quay.io | |
run: echo "${{ secrets.CR_PASSWORD }}" | docker login quay.io -u ${{ secrets.CR_USERNAME }} --password-stdin | |
- name: Build Images | |
run: | | |
cp template.env .env | |
docker compose build | |
- name: Set branch tag | |
id: branch | |
run: | | |
# Strip git ref prefix from version | |
branch_tag=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && branch_tag=$(echo $branch_tag | sed -e 's/^v//') | |
# preprend with "branch_" so we know what the tag means by looking at it. | |
branch_tag="branch_${branch_tag}" | |
echo ::set-output name=tag::$(echo $branch_tag) | |
- name: Set commit tag | |
id: commit | |
run: | | |
# The short git commit object name. | |
commit_tag=${GITHUB_SHA::8} | |
# prepend with "commit_" so we know what the tag means by looking at it. | |
commit_tag="commit_${commit_tag}" | |
echo ::set-output name=tag::$(echo $commit_tag) | |
- name: Push externallinks image to quay.io/wikipedialibrary | |
run: | | |
# The image name represents both the local image name and the remote image repository. | |
image_name=quay.io/wikipedialibrary/externallinks | |
branch_tag=${{ steps.branch.outputs.tag }} | |
commit_tag=${{ steps.commit.outputs.tag }} | |
docker tag ${image_name}:latest ${image_name}:${branch_tag} | |
docker tag ${image_name}:latest ${image_name}:${commit_tag} | |
docker push ${image_name}:${branch_tag} | |
docker push ${image_name}:${commit_tag} | |
- name: Push eventstream image to quay.io/wikipedialibrary | |
run: | | |
# The image name represents both the local image name and the remote image repository. | |
image_name=quay.io/wikipedialibrary/eventstream | |
branch_tag=${{ steps.branch.outputs.tag }} | |
commit_tag=${{ steps.commit.outputs.tag }} | |
docker tag ${image_name}:latest ${image_name}:${branch_tag} | |
docker tag ${image_name}:latest ${image_name}:${commit_tag} | |
docker push ${image_name}:${branch_tag} | |
docker push ${image_name}:${commit_tag} |