245 integration environment for didcomm mediator server deployment e6 #14
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: Build and Publish Docker Image | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build and tag Docker Compose images | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/heads/main" ]] && VERSION=latest | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
echo "Building and tagging image: ${IMAGE_NAME}:${VERSION}" | |
docker-compose build | |
docker tag ghcr.io/adorsys/didcomm-mediator-rs:latest ${IMAGE_NAME}:${VERSION} | |
- name: Push Docker image | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/heads/main" ]] && VERSION=latest | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
echo "Pushing image ${IMAGE_NAME}:${VERSION}" | |
docker push ${IMAGE_NAME}:${VERSION} |