-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (45 loc) · 1.42 KB
/
docker.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
name: Docker
on:
workflow_dispatch:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
# checkout source code
- name: Check out source code
uses: actions/checkout@v2
# calculate some variables that are used later
- name: Version information
run: |
if [ "${{ github.event.release.target_commitish }}" != "" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
elif [[ $GITHUB_REF =~ pull ]]; then
BRANCH="$(echo $GITHUB_REF | sed 's#refs/pull/\([0-9]*\)/merge#PR-\1#')"
else
BRANCH=${GITHUB_REF##*/}
fi
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
if [ "$BRANCH" == "main" ]; then
TAGS=latest
else
TAGS=${BRANCH}
fi
echo "TAGS=${TAGS}" >> $GITHUB_ENV
# build image
- name: Build image
uses: elgohr/[email protected]
env:
BRANCH: ${{ env.GITHUB_BRANCH }}
BUILDNUMBER: ${{ github.run_number }}
GITSHA1: ${{ github.sha }}
with:
name: NorESMhub/noresm-lsp-ui
tags: "${{ env.TAGS }}"
buildargs: BRANCH,BUILDNUMBER,GITSHA1,PUBLIC_PATH,API_SERVER
dockerfile: docker/Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io