Update MFE submodules #411
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: CI | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
inputs: | |
skip_build_openedx_job: | |
required: true | |
type: boolean | |
default: true | |
skip_build_mfe_job: | |
required: true | |
type: boolean | |
default: true | |
env: | |
DOCKER_BUILDX: "1" | |
SERVER_IP: babilonia.abzt.de | |
TUTOR_ROOT: ${{ github.repository }} | |
TUTOR_PLUGINS_ROOT: $TUTOR_ROOT/plugins | |
OPENEDX_CACHE_IMAGE: docker.io/abstract2tech/community-theme-openedx-cache | |
MFE_CACHE_IMAGE: docker.io/abstract2tech/community-theme-mfe-cache | |
jobs: | |
build-openedx: | |
env: | |
OPENEDX_IMAGE: docker.io/abstract2tech/community-theme-openedx:16.1.0 | |
runs-on: ubuntu-latest | |
if : ${{ !inputs.skip_build_openedx_job }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Export TUTOR_ variables | |
run: | | |
echo "TUTOR_ROOT=${GITHUB_WORKSPACE}" >> ${GITHUB_ENV} | |
echo "TUTOR_PLUGINS_ROOT=${GITHUB_WORKSPACE}/plugins" >> ${GITHUB_ENV} | |
echo "TUTOR_APP=community-theme" >> ${GITHUB_ENV} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker buildx | |
run: docker buildx create --use | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install requirements | |
run: pip install -r requirements.txt | |
- name: Generate tutor env | |
run: tutor config save | |
- name: Build tutor openedx image | |
run: | | |
docker login -u abstract2tech -p ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
tutor images build openedx | |
tutor images push openedx | |
build-mfe: | |
runs-on: ubuntu-latest | |
env: | |
MFE_IMAGE: docker.io/abstract2tech/community-theme-mfe:16.1.0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Export TUTOR_ variables | |
run: | | |
echo "TUTOR_ROOT=${GITHUB_WORKSPACE}" >> ${GITHUB_ENV} | |
echo "TUTOR_PLUGINS_ROOT=${GITHUB_WORKSPACE}/plugins" >> ${GITHUB_ENV} | |
echo "TUTOR_APP=community-theme" >> ${GITHUB_ENV} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install requirements | |
run: pip install -r requirements.txt | |
- name: Docker buildx | |
run: docker buildx create --use | |
- name: Generate tutor env | |
run: tutor config save | |
- name: Build tutor MFE image | |
run: | | |
docker login -u abstract2tech -p ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
tutor images build mfe | |
tutor images push mfe | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
if: ${{ always() && (needs.build-openedx.result == 'success' || needs.build-openedx.result == 'skipped') }} | |
needs: [build-openedx, build-mfe] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add SSH key to agent | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} | |
run: | | |
eval $(ssh-agent) | |
if [ ! -d ~/.ssh ]; then | |
mkdir -p ~/.ssh && chmod 700 ~/.ssh | |
fi | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-add ~/.ssh/id_rsa | |
ssh-keyscan babilonia.abzt.de > ~/.ssh/known_hosts | |
pip install ansible==7.2.0 | |
ansible-galaxy install -r requirements.yml -p ansible/roles/ | |
cd $GITHUB_WORKSPACE/ansible | |
echo "$ANSIBLE_VAULT_PASSWORD" > vault_pass | |
chmod 600 vault_pass | |
ansible-playbook --vault-password-file ./vault_pass -u tutor -i inventory.ini -l babilonia.abzt.de --tags tutor_deploy tutor.yml |