Skip to content

Commit 77a3ea5

Browse files
committed
Splitting build, test and deploy actions
1 parent 7eb8b62 commit 77a3ea5

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

.github/workflows/build-test-deploy.yml renamed to .github/workflows/build-test.yml

+11-8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ on:
44
push:
55
branches:
66
trunk
7+
pull_request:
8+
branches:
9+
trunk
710

811
jobs:
912
build-and-test:
13+
# Skip job based on the commit message
14+
if: contains(toJson(github.event.commits), '[skip ci]') == false
1015
name: Build & test Docker images with random user
1116
runs-on: ubuntu-18.04
1217
strategy:
@@ -16,20 +21,18 @@ jobs:
1621
- uses: actions/checkout@v1
1722
- name: Output Docker info
1823
run: docker info
19-
- name: Gets tag as env var if present
20-
run: echo ::set-env name=GITHUB_TAG::${GITHUB_REF#refs/*/}
21-
- name: Output GITHUB_TAG if present
22-
run: |
23-
echo $GITHUB_TAG
24-
echo ${{ env.GITHUB_TAG }}
2524
- name: Set up Python 3.8
2625
uses: actions/setup-python@v2
2726
with:
2827
python-version: 3.8
28+
- name: Extract branch Name
29+
run: echo "::set-env name=BRANCH::$(echo ${GITHUB_REF##*/})"
30+
- name: Output branch name
31+
run: echo ${BRANCH}
2932
- name: Build Docker images
30-
run: VERSION=${GITHUB_SHA} make build
33+
run: VERSION=${BRANCH} make build
3134
- name: Test Docker images
32-
run: USE_RANDOM_USER_ID=${USE_RANDOM_USER} VERSION=${GITHUB_SHA} make test
35+
run: USE_RANDOM_USER_ID=${USE_RANDOM_USER} VERSION=${BRANCH} make test
3336
env:
3437
USE_RANDOM_USER: ${{ matrix.use-random-user }}
3538

.github/workflows/deploy.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploys
2+
3+
on:
4+
push:
5+
tags:
6+
7+
jobs:
8+
build-and-test:
9+
# Skip job based on the commit message
10+
if: contains(toJson(github.event.commits), '[skip ci]') == false
11+
name: Deploy Docker images
12+
runs-on: ubuntu-18.04
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Output Docker info
16+
run: docker info
17+
- name: Gets tag as env var if present
18+
run: echo ::set-env name=TAG::${GITHUB_REF#refs/*/}
19+
- name: Output tag if present
20+
run: echo ${TAG}
21+
- name: Build
22+
run: VERSION="${TAG}" make build
23+
- name: Login Docker Hub
24+
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
25+
env:
26+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
27+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
28+
- name: Deploy new images
29+
run: VERSION="${TRAVIS_TAG}" make release
30+
# - name: Deploy tag latest
31+
# run: VERSION="${TRAVIS_TAG}" make tag_latest
32+
# - name: Deploy release latest
33+
# run: VERSION="${TRAVIS_TAG}" make release_latest

0 commit comments

Comments
 (0)