Skip to content

ci: build docker image #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,75 @@ jobs:
strategy:
matrix:
include:
# https://github.com/actions/runner-images#available-images
- os: ubuntu-latest
locale: C.UTF-8
env:
LC_ALL: ${{ matrix.locale }}
LANG: ${{ matrix.locale }}

steps:
##### Setup environment
# https://github.com/actions/checkout
- uses: actions/checkout@v4
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: "pip"

- name: Install Hatch
uses: pypa/hatch@install
- name: Print info about the current python installation
run: make ci-info
- name: Install requirements
run: make bootstrap-dev
- name: Check or download gh utility
run: |
if ! which gh; then
echo "Downloading 'gh' utility"
if [ "$(uname -s)" = "Linux" ]; then
curl -L -o gh.tar.gz https://github.com/cli/cli/releases/download/v2.28.0/gh_2.28.0_linux_amd64.tar.gz
tar xzf gh.tar.gz
mv ./gh_2.28.0_linux_amd64/bin/gh /usr/local/bin/gh
else
curl -L -o gh.zip https://github.com/cli/cli/releases/download/v2.28.0/gh_2.28.0_macOS_amd64.zip
unzip xzf gh.zip
mv ./gh_2.28.0_macOS_amd64/bin/gh /usr/local/bin/gh
fi
which gh
fi

##### Create release on GitHub
- name: Create or update GitHub release
run: scriv github-release --repo=codewithemad/tutor-contrib-wordpress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

##### Publish to PyPI
- name: Build and publish to PyPI
run: |
hatch build
hatch publish
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}

build_and_push_image:
needs: release # Wait for release job to complete successfully
runs-on: ubuntu-latest
container: python:3.9-slim

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Install Tutor
run: pip install tutor

- name: Install tutor-plugin-wordpress
run: pip install git+https://github.com/codewithemad/tutor-contrib-wordpress@${{ env.TAG }}

- name: Initialize Tutor
run: |
tutor config save --interactive=false
tutor plugins enable wordpress

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Build and push WordPress image
run: |
tutor images build wordpress
tutor images push wordpress
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ You can retrieve these configuration values by running:

.. code-block:: bash

tutor dev|local|k8s do wordpress config
tutor wordpress config

This command will output the current configurations, including the Client ID, Client Secret, Open edX Domain,
and WordPress Domain. Here is an example of the output:
Expand All @@ -88,8 +88,8 @@ and WordPress Domain. Here is an example of the output:
Client ID (dev): MlbXk1V3wB7nWPAAyLF3McyfBBMqExa4
Client Secret: MdrgbtU8Q94He3gejF6Zf5MDookoeozO

Open edX Domain: http://local.edly.io:8000
Wordpress Domain: http://site.local.edly.io:8080
Open edX Domain: http://local.openedx.io:8000
Wordpress Domain: http://site.local.openedx.io:8080

Variables
*********
Expand Down
1 change: 0 additions & 1 deletion tutorwordpress/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from glob import glob
import os
import sys
import typing as t

import click
from tutor import fmt, hooks as tutor_hooks, config as tutor_config
Expand Down