Merge pull request #1363 from appsembler/feat/tahoe-idp-2.6.0 #1051
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: | |
branches: | |
- main | |
- prod | |
pull_request: | |
branches: | |
- main | |
- prod | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 'Build the Tutor Docker images' | |
shell: bash | |
run: | | |
# Build both images at once corresponding to `edx-platform` branch names | |
docker build --target edxapp-build --tag edxapp-build-prod --file Dockerfile.tutor . | |
docker build --target edxapp-build-experimental --tag edxapp-build-main --file Dockerfile.tutor . | |
- name: 'Set env.BRANCH to the current git branch' | |
run: | | |
echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | |
- name: 'Login to DockerHub' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERUSER }} | |
password: ${{ secrets.DOCKERPASSWORD }} | |
if: ${{ env.BRANCH == 'main' || env.BRANCH == 'prod' }} | |
- name: 'build devstack image (push after merge to `main`)' | |
shell: bash | |
run: | | |
# This overrides same-day merges on `main` but it's devstack so it doesn't matter much | |
DATE=$(date --iso-8601) | |
make DATE="$DATE" devstack-docker-build | |
if [ "$BRANCH" == "main" ]; then | |
make DATE="$DATE" devstack-docker-push | |
fi | |
- name: 'Push the Tutor docker images after merge to `main` and `prod`' | |
shell: bash | |
run: | | |
IMAGE_NAME="appsembler/edxapp-juniper" | |
# Tag images from either `main` or `prod` | |
BRANCH_IMAGE_TAG="$IMAGE_NAME:$BRANCH-$(date +'%Y-%m-%d')-$(git rev-parse --short HEAD)" | |
BRANCH_IMAGE_LATEST="$IMAGE_NAME:$BRANCH" | |
docker tag "edxapp-build-$BRANCH" "$BRANCH_IMAGE_TAG"; # pin the build in history | |
docker tag "edxapp-build-$BRANCH" "$BRANCH_IMAGE_LATEST"; # branch's "latest" image | |
docker push "$BRANCH_IMAGE_TAG"; | |
docker push "$BRANCH_IMAGE_LATEST"; | |
if: ${{ env.BRANCH == 'main' || env.BRANCH == 'prod' }} |