initial-image-build-workflow #33
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: "initial-image-build-workflow" | |
on: | |
# Trigger a specific workflow run on demand without need for a code push/pull request | |
workflow_dispatch: | |
inputs: | |
githubRepo: | |
description: "Link of public github repo to deploy" | |
required: true | |
jobs: | |
create_docker_image: | |
permissions: | |
contents: "write" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install Github dependents info | |
run: pip install -U github-dependents-info | |
- name: Add student's repo as a submodule | |
run: | | |
year=$(date '+%Y') | |
user_name=$(echo "${{ github.event.inputs.githubRepo }}" | cut -d'/' -f4) | |
repo_name=$(echo "${{ github.event.inputs.githubRepo }}" | cut -d'/' -f5) | |
if [ ! -d submissions-${year}/${user_name}-${repo_name} ]; then | |
echo "Adding ${{ github.event.inputs.githubRepo }} to ./submissions-${year}/${user_name}-${repo_name} as a submodule" | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
git submodule add ${{ github.event.inputs.githubRepo }} ./submissions-${year}/${user_name}-${repo_name} | |
git commit -m "Added ${user_name}-${repo_name} as a submodule by github-actions" | |
git push | |
else | |
echo "Submodule already exists, terminating github actions" | |
fi | |
cd ./submissions-${year}/${user_name}-${repo_name} | |
# need to add export DOCKER_BUILDKIT=1 before building python docker image |