-
Notifications
You must be signed in to change notification settings - Fork 1k
53 lines (53 loc) · 2.34 KB
/
build_container_image.yaml
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
name: Build Container Image
on:
push:
branches:
- 'release*'
- anvil
concurrency:
group: docker-build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build container image
runs-on: ubuntu-latest
if: github.repository_owner == 'galaxyproject'
steps:
- uses: actions/checkout@v2
# https://stackoverflow.com/questions/59810838/how-to-get-the-short-sha-for-the-github-workflow
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Set branch name
id: branch
run: echo "::set-output name=name::$(BRANCH_NAME=${GITHUB_REF##*/}; echo ${BRANCH_NAME/release_/}-auto)"
- name: Login to docker hub
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- run: docker build . -t galaxy/galaxy-min:${{ steps.vars.outputs.sha_short }} -f .k8s_ci.Dockerfile
- name: Push to docker hub with commit ID
uses: actions-hub/docker@master
with:
args: push galaxy/galaxy-min:${{ steps.vars.outputs.sha_short }}
- run: docker tag galaxy/galaxy-min:${{ steps.vars.outputs.sha_short }} galaxy/galaxy-min:${{ steps.branch.outputs.name }}
- name: Push to docker hub with branch name
uses: actions-hub/docker@master
with:
args: push galaxy/galaxy-min:${{ steps.branch.outputs.name }}
- run: docker tag galaxy/galaxy-min:${{ steps.vars.outputs.sha_short }} quay.io/galaxy-k8s/galaxy:${{ steps.branch.outputs.name }} && docker tag galaxy/galaxy-min:${{ steps.vars.outputs.sha_short }} quay.io/galaxy-k8s/galaxy:${{ steps.vars.outputs.sha_short }}
- name: Login to docker hub
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
DOCKER_REGISTRY_URL: quay.io
- name: Push to quay.io with commit ID
uses: actions-hub/docker@master
with:
args: push quay.io/galaxy-k8s/galaxy:${{ steps.vars.outputs.sha_short }}
- name: Push to quay.io with branch name
uses: actions-hub/docker@master
with:
args: push quay.io/galaxy-k8s/galaxy:${{ steps.branch.outputs.name }}