Adds step to build action to circumvent missing .env.local #986
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 && ./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 Image | |
run: | | |
cd docker | |
docker compose build --no-cache webserver app | |
- name: Push App Images | |
run: | | |
docker tag ucfopen/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-${{ github.sha }} | |
docker tag ucfopen/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-${{ steps.tag_name.outputs.GIT_TAG }} | |
docker tag ucfopen/materia:webserver-dev ghcr.io/${{ github.repository_owner }}/materia:webserver-${{ github.sha }} | |
docker tag ucfopen/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 |