-
Notifications
You must be signed in to change notification settings - Fork 14
66 lines (58 loc) · 2.23 KB
/
create-release.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
55
56
57
58
59
60
61
62
63
64
65
66
name: "Create release"
on:
push:
tags:
- "**"
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l -e -o pipefail {0}
env:
IMAGE_NAME: bambi
REPOSITORY_OWNER: ${{ github.repository_owner }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Fetch Tags"
# Workaround for https://github.com/actions/checkout/issues/290
run: git fetch --tags --force
- name: "Get release variables"
# RELEASE_VERSION assignment must match the command used in autoconf's
# configure.ac file. On update, care should be taken to maintain both
# sides congruent.
run: |
echo 'RELEASE_VERSION='$(git describe --always --tags --dirty) >> $GITHUB_ENV
echo 'GIT_URL='$(git remote get-url origin) >> $GITHUB_ENV
echo 'GIT_COMMIT='$(git log --pretty=format:'%H' -n 1) >> $GITHUB_ENV
- name: "Login to Docker registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build Docker image"
run: |
set -x
docker build --rm \
--file docker/Dockerfile \
--build-arg HTSLIB_BRANCH=1.18 \
--platform linux/amd64 \
--progress plain \
--load \
--label "org.opencontainers.image.title=bambi" \
--label "org.opencontainers.image.source=${GIT_URL}" \
--label "org.opencontainers.image.revision=${GIT_COMMIT}" \
--label "org.opencontainers.image.version=${RELEASE_VERSION}" \
--label "org.opencontainers.image.created=$(date --utc --iso-8601=seconds)" \
--label "org.opencontainers.image.vendor=npg.sanger.ac.uk" \
--tag "ghcr.io/$REPOSITORY_OWNER/${IMAGE_NAME}:${RELEASE_VERSION}" \
--tag "ghcr.io/$REPOSITORY_OWNER/${IMAGE_NAME}:latest" \
.
- name: "Push image to registry"
run: |
docker push "ghcr.io/$REPOSITORY_OWNER/$IMAGE_NAME:$RELEASE_VERSION"
docker push "ghcr.io/$REPOSITORY_OWNER/$IMAGE_NAME:latest"