Skip to content

Commit

Permalink
Splitting build, test and deploy actions
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Jul 18, 2020
1 parent 7eb8b62 commit 77a3ea5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
Expand Up @@ -4,9 +4,14 @@ on:
push:
branches:
trunk
pull_request:
branches:
trunk

jobs:
build-and-test:
# Skip job based on the commit message
if: contains(toJson(github.event.commits), '[skip ci]') == false
name: Build & test Docker images with random user
runs-on: ubuntu-18.04
strategy:
Expand All @@ -16,20 +21,18 @@ jobs:
- uses: actions/checkout@v1
- name: Output Docker info
run: docker info
- name: Gets tag as env var if present
run: echo ::set-env name=GITHUB_TAG::${GITHUB_REF#refs/*/}
- name: Output GITHUB_TAG if present
run: |
echo $GITHUB_TAG
echo ${{ env.GITHUB_TAG }}
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Extract branch Name
run: echo "::set-env name=BRANCH::$(echo ${GITHUB_REF##*/})"
- name: Output branch name
run: echo ${BRANCH}
- name: Build Docker images
run: VERSION=${GITHUB_SHA} make build
run: VERSION=${BRANCH} make build
- name: Test Docker images
run: USE_RANDOM_USER_ID=${USE_RANDOM_USER} VERSION=${GITHUB_SHA} make test
run: USE_RANDOM_USER_ID=${USE_RANDOM_USER} VERSION=${BRANCH} make test
env:
USE_RANDOM_USER: ${{ matrix.use-random-user }}

33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
@@ -0,0 +1,33 @@
name: Deploys

on:
push:
tags:

jobs:
build-and-test:
# Skip job based on the commit message
if: contains(toJson(github.event.commits), '[skip ci]') == false
name: Deploy Docker images
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Output Docker info
run: docker info
- name: Gets tag as env var if present
run: echo ::set-env name=TAG::${GITHUB_REF#refs/*/}
- name: Output tag if present
run: echo ${TAG}
- name: Build
run: VERSION="${TAG}" make build
- name: Login Docker Hub
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- name: Deploy new images
run: VERSION="${TRAVIS_TAG}" make release
# - name: Deploy tag latest
# run: VERSION="${TRAVIS_TAG}" make tag_latest
# - name: Deploy release latest
# run: VERSION="${TRAVIS_TAG}" make release_latest

0 comments on commit 77a3ea5

Please sign in to comment.