Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update container labels #239

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,39 @@ on:
- "devel"

jobs:

build-and-publish:
runs-on: ubuntu-latest

steps:
env:
IMAGE_NAME: npg_langqc
REPOSITORY_OWNER: ${{ github.repository_owner }}
BRANCH: ${{ github.ref_name }}
GIT_URL: ${{ github.repositoryUrl }}

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: "Get release variables"
run: |
echo 'GIT_COMMIT='$(git log --pretty=format:'%H' -n 1) >> $GITHUB_ENV
echo 'RELEASE_VERSION='$(git describe --always --tags --dirty) >> $GITHUB_ENV

- name: Build and push docker images
run: |
# Set BRANCH to latest if BRANCH is master
[ $BRANCH = "master" ] && BRANCH=latest
docker build --target production --label $REPOLABEL -t ghcr.io/${{ github.repository_owner }}/npg_langqc:${BRANCH} .
docker image push ghcr.io/${{ github.repository_owner}}/npg_langqc:${BRANCH}
env:
REPOLABEL: "org.opencontainers.image.source=${{ github.repository_url }}"
BRANCH: ${{ github.ref_name }}

docker build \
--target production \
--label org.opencontainers.image.title=${IMAGE_NAME} \
--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}:${BRANCH} .
docker image push ghcr.io/$REPOSITORY_OWNER/${IMAGE_NAME}:${BRANCH}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
* Updated container labels

## [2.3.0] - 2024-07-30

Expand Down