-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 2.17 KB
/
main.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
name: CI
on: [push, pull_request, release]
jobs:
main:
runs-on: ubuntu-20.04
env:
# webpack build needs a lot of memory
NODE_OPTIONS: --max_old_space_size=4096
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
# Ensures all refs and tags are fetched so "git describe --always" is working as expected
fetch-depth: 0
# A workaround for annotated tags with actions/checkout@v2
# see https://github.com/actions/checkout/issues/290
- name: Fetch Tags correctly
run: git fetch --force --tags
- name: Cache gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Run unit tests
run: ./gradlew check jibDockerBuild
- name: Prepare cache
run: |
rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- name: Before Deploy
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
run: |
pip3 install --upgrade pip
pip3 install docker-ci-deploy
docker logout
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"
- name: Deploy master branch as latest
if: github.ref == 'refs/heads/master'
run: python -m docker_ci_deploy --tag latest -- cfreak/breeze
# ${GITHUB_REF/refs\/tags\//} returns the tag name from 'refs/tags/TAG_NAME'
- name: Deploy tags
if: startsWith(github.ref, 'refs/tags')
run: python -m docker_ci_deploy --version-latest --version ${GITHUB_REF/refs\/tags\//} --version-semver cfreak/codefreak