First-time setup and dev docker compose config overhaul #1049
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: Run Tests | |
on: [push, pull_request] | |
jobs: | |
ci_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Run Tests | |
run: cd docker && touch .env.local && ./run_tests_ci.sh | |
docker_images_and_release_zip: | |
needs: ci_tests | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Capture Tag Name | |
id: tag_name | |
run: echo ::set-output name=GIT_TAG::${GITHUB_REF#refs/tags/} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CR_USER }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create .env.local to satisfy build requirements | |
run: | | |
cd docker | |
if [ ! -f .env.local ]; then | |
touch .env.local | |
fi | |
- name: Build App and Webserver Images | |
run: | | |
cd docker | |
docker compose build --no-cache webserver app | |
docker compose -f docker-compose.yml -f docker-compose.development.yml build --no-cache fakes3 | |
- name: Push Dev App and Webserver Images | |
if: ${{ startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-alpha') || contains(github.ref, '-rc')) }} | |
run: | | |
docker push ghcr.io/${{ github.repository_owner }}/materia:app-dev | |
docker push ghcr.io/${{ github.repository_owner }}/materia:webserver-dev | |
docker push ghcr.io/${{ github.repository_owner }}/materia:fake-s3-dev | |
- name: Push Stable App and Webserver Images | |
if: ${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-alpha') && !contains(github.ref, '-rc') }} | |
run: | | |
docker tag ghcr.io/${{ github.repository_owner }}/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-stable | |
docker tag ghcr.io/${{ github.repository_owner }}/materia:webserver-dev ghcr.io/${{ github.repository_owner }}/materia:webserver-stable | |
docker push ghcr.io/${{ github.repository_owner }}/materia:app-stable | |
docker push ghcr.io/${{ github.repository_owner }}/materia:webserver-stable | |
- name: Push Versioned App and Webserver Images | |
run: | | |
docker tag ghcr.io/${{ github.repository_owner }}/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-${{ github.sha }} | |
docker tag ghcr.io/${{ github.repository_owner }}/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-${{ steps.tag_name.outputs.GIT_TAG }} | |
docker tag ghcr.io/${{ github.repository_owner }}/materia:webserver-dev ghcr.io/${{ github.repository_owner }}/materia:webserver-${{ github.sha }} | |
docker tag ghcr.io/${{ github.repository_owner }}/materia:webserver-dev ghcr.io/${{ github.repository_owner }}/materia:webserver-${{ steps.tag_name.outputs.GIT_TAG }} | |
docker push ghcr.io/${{ github.repository_owner }}/materia:app-${{ github.sha }} | |
docker push ghcr.io/${{ github.repository_owner }}/materia:app-${{ steps.tag_name.outputs.GIT_TAG }} | |
docker push ghcr.io/${{ github.repository_owner }}/materia:webserver-${{ github.sha }} | |
docker push ghcr.io/${{ github.repository_owner }}/materia:webserver-${{ steps.tag_name.outputs.GIT_TAG }} | |
# run_build_github_release_package.sh relies on the current git user info | |
- name: Build Package | |
run: | | |
git config --global user.email "lst@ucf.edu" | |
git config --global user.name "ucfcdl-robot" | |
cd docker && ./run_build_github_release_package.sh ghcr.io/${{ github.repository_owner }}/materia:app-${{ steps.tag_name.outputs.GIT_TAG }} | |
- name: Upload to Release | |
if: ${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-alpha') && !contains(github.ref, '-rc') }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: materia-pkg* | |
file_glob: true | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: Upload to Pre-Release | |
if: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-alpha') || contains(github.ref, '-rc') }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: materia-pkg* | |
file_glob: true | |
tag: ${{ github.ref }} | |
overwrite: true | |
prerelease: true |