-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (54 loc) · 1.72 KB
/
publish.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
54
55
56
57
58
59
60
61
62
63
64
65
name: Docker publish
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
# Adds ability to run this workflow manually
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: scilifelabdatacentre/serve-load-testing
#IMAGE_NAME: ${{ github.repository }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value={{date 'YYYYMMDD-HHmm' tz='Europe/Stockholm'}},prefix=${{ github.ref_name }}-
- name: Output docker image information
run: |
echo "Branch GITHUB_REF##*/: ${GITHUB_REF##*/}"
#echo "github.refname: $github.ref_name"
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Publish image to GHCR
uses: docker/build-push-action@v3
with:
file: ./source/Dockerfile
context: ./source
push: true
build-args: version=${{ github.ref_name }}
tags: |
${{ steps.meta.outputs.tags }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}