-
Notifications
You must be signed in to change notification settings - Fork 34
74 lines (65 loc) · 2.97 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
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: 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 "[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