-
Notifications
You must be signed in to change notification settings - Fork 34
97 lines (85 loc) · 4.47 KB
/
test_and_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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 "[email protected]"
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