π fix some typos in comments (#452) #148
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
# GitHub workflow for deploying the Docker image to Docker Hub. | |
# This is done by substituting and compiling the code | |
# from the master branch into the concept:test-build image, | |
# then pushing it as concept:latest. | |
name: deploy_docker | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
check_deploy: | |
runs-on: ubuntu-22.04 | |
outputs: | |
deploy: ${{ steps.check_deploy.outputs.deploy }} | |
steps: | |
- name: π Check whether to deploy | |
id: check_deploy | |
env: | |
docker_password: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
if [ -n "${docker_password}" ]; then | |
echo "Will be deployed" | |
echo "deploy=1" >> "${GITHUB_OUTPUT}" | |
else | |
echo "Will not be deployed" | |
fi | |
deploy_docker: | |
runs-on: ubuntu-22.04 | |
needs: check_deploy | |
if: needs.check_deploy.outputs.deploy | |
steps: | |
- name: ποΈ Checkout | |
uses: actions/checkout@v4 | |
- name: π Clean dangling Docker containers | |
uses: ./.github/actions/docker-clean | |
- name: π Set temporary Docker container name | |
run: | | |
echo "docker_container=${GITHUB_REPOSITORY//\//_}__${GITHUB_WORKFLOW}__${GITHUB_JOB}__$(date +%s)" >> "${GITHUB_ENV}" | |
- name: π Pull Docker image | |
run: docker pull ${{ secrets.DOCKER_USERNAME }}/concept:test-build | |
- name: π§ Build code | |
run: | | |
docker run \ | |
-v "${GITHUB_WORKSPACE}":/github \ | |
--name ${docker_container} \ | |
${{ secrets.DOCKER_USERNAME }}/concept:test-build \ | |
bash -O extglob -c ': \ | |
&& source ~/.bashrc \ | |
&& rm -rf "${concept_dir}/"!(dep) \ | |
&& cp -r /github/!(dep) "${concept_dir}/" \ | |
&& (cd "${concept_dir}" && make distclean) \ | |
&& make_jobs="-j 1" concept \ | |
&& (cd "${concept_dir}" && make clean-job) \ | |
&& mkdir -p "${tmp_dir}/so" \ | |
&& mv "${build_dir}"/*.so "${tmp_dir}/so/" \ | |
&& (cd "${concept_dir}" && make clean) \ | |
&& mkdir -p "${build_dir}" \ | |
&& mv "${tmp_dir}"/so/* "${build_dir}/" \ | |
&& (cd "${concept_dir}" && make clean-tmp) \ | |
&& (find / -type d -a -name "__pycache__" -exec rm -rf "{}" + || :) \ | |
' | |
docker commit \ | |
--change='CMD ["bash"]' \ | |
${docker_container} \ | |
${{ secrets.DOCKER_USERNAME }}/concept:latest | |
docker rm -f ${docker_container} 2>/dev/null || : | |
- name: π Deploy Docker image | |
run: | | |
echo ${{ secrets.DOCKER_PASSWORD }} \ | |
| docker login \ | |
-u ${{ secrets.DOCKER_USERNAME }} \ | |
--password-stdin \ | |
2>/dev/null | |
docker push ${{ secrets.DOCKER_USERNAME }}/concept:latest | |
docker logout | |