Merge pull request #1 from grycap/devel #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: | |
- main | |
- devel | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: GHCR login and image tags | |
env: | |
GHCR_USERNAME: ${{ github.actor }} | |
GHCR_TOKEN: ${{ secrets.REGISTRY_TOKEN }} | |
run: echo "${GHCR_TOKEN}" | docker login ghcr.io --username "${GHCR_USERNAME}" --password-stdin | |
- name: Set tag | |
id: settag | |
run: | | |
GHCR_IMAGE=ghcr.io/grycap/oscar-metrics | |
if [[ $GITHUB_REF == refs/heads/devel ]]; then | |
TAG="${GHCR_IMAGE}:devel" | |
else | |
TAG="${GHCR_IMAGE}:latest" | |
fi | |
echo ::set-output name=tag::${TAG} | |
- name: Build the Docker image | |
id: push | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.settag.outputs.tag }} | |
#docker build . --file Dockerfile --output "type=image,push=true" --tag ${TAG} |