-
Notifications
You must be signed in to change notification settings - Fork 21
54 lines (53 loc) · 2.03 KB
/
deploydocker.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
name: Deploy docker image (ubuntu) to ghcr.io
on:
workflow_dispatch:
push:
branches:
- master
- 'release/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
# export branch name to be available in the GA environment as: steps.extract_branch.outputs.branch
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
id: extract_branch
- name: Define tag name
shell: bash
run: |
BRANCH=${{ steps.extract_branch.outputs.branch }}
## use latest to follow docker conventions
if [[ "$BRANCH" == "master" ]]
then
BRANCH="latest"
fi
## Remove release/ from release branch name
echo "tag=$(echo ${BRANCH#release/})" >> $GITHUB_OUTPUT
id: tag_name
- name: Downcase REPO
run: echo "repo=$(echo ${GITHUB_REPOSITORY,,})" >> $GITHUB_OUTPUT
id: downcase_repo
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout to make context with dockerfiles available
uses: actions/checkout@v4
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
push: true # Will only build if this is not here
context: .
file: dockerfiles/Dockerfile
build-args: |
OPENMS_VERSION: ${{ steps.tag_name.outputs.tag }}
tags: |
ghcr.io/${{ steps.downcase_repo.outputs.repo }}:${{ steps.tag_name.outputs.tag }}
cache-from: type=gha,scope=ghcr.io/${{ steps.downcase_repo.outputs.repo }}:${{ steps.tag_name.outputs.tag }}
cache-to: type=gha,mode=max,scope=ghcr.io/${{ steps.downcase_repo.outputs.repo }}:${{ steps.tag_name.outputs.tag }}