Skip to content

Commit

Permalink
Feature/automated docker release (#42)
Browse files Browse the repository at this point in the history
* Changes

-> Created a separate yaml file only for releases (develop -> main)
-> Renamed yaml files

* correct tag

Correct test tag, instead of tag test

* Combining to a single workflow

* Testing Docker Image Push

* fixed the condition back
  • Loading branch information
emre-f authored Feb 8, 2022
1 parent 01254b5 commit 27c79e1
Showing 1 changed file with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub Actions Migration
name: Standard Tests Workflow
on: [push, pull_request, workflow_dispatch] #workflow_dispatch works only if its active in the main branch
jobs:
Unit-Test:
Expand Down Expand Up @@ -65,10 +65,10 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }} #didn't fix
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
push: true #not pushing the docker image yet
tags: ga4gh/ga4gh-starter-kit-common:test
push: true
tags: ga4gh/ga4gh-starter-kit-common:test #labelled test because it is only needed for the Gradle Integ. Tests
build-args: VERSION=${{ env.version }}
cache-from: type=gha #GitHub Actions Cache Exporter
cache-to: type=gha,mode=max
Expand All @@ -80,3 +80,37 @@ jobs:
- name: Gradle Integration Test
run: ./gradlew test --tests=integration.*

Docker-Release:
needs: Docker-Integration-Test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push' #Only runs if pushing to main
steps:
- uses: actions/checkout@v2

- name: Setting Up Docker Buildx #used for caching image layers, improves performance
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Get and Set Version
run: |
source ci/set-docker-image-version.sh
echo "version=${DOCKER_IMG_VER}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
push: true
tags: ga4gh/ga4gh-starter-kit-common:${{ env.version }} #Using the correct version as the tag
build-args: VERSION=${{ env.version }}
cache-from: type=gha #GitHub Actions Cache Exporter
cache-to: type=gha,mode=max

0 comments on commit 27c79e1

Please sign in to comment.