245 integration environment for didcomm mediator server deployment e6 #8
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: Create and publish a Docker image | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
# with: | |
# path: . | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build Docker image | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Use `latest` for specific branch builds, or use tags for versioning. | |
[[ "${{ github.ref }}" == "refs/heads/main" ]] && VERSION=latest | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
echo "Building image with version: $VERSION" | |
docker-compose build | |
docker tag ${IMAGE_NAME} ${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} |