Skip to content

Commit

Permalink
fix(): update yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Christiantyemele committed Dec 4, 2024
1 parent 0085807 commit 26997ea
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Publish Docker Image
name: Create and publish a Docker image

on:
push:
Expand All @@ -9,10 +9,10 @@ on:
pull_request:

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
IMAGE_NAME: ghcr.io/adorsys/didcomm-mediator-rs

jobs:
build-and-push:
push:
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -22,18 +22,31 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- 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 and tag Docker Compose images
- name: Build Docker image
run: |
echo "Checking for .env file..."
if [ -f .env ]; then
echo ".env file exists."
else
echo ".env file does not exist."
exit 1
fi
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}"
echo "Building image with version: $VERSION"
docker-compose build
docker tag ghcr.io/adorsys/didcomm-mediator-rs:latest ${IMAGE_NAME}:${VERSION}
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION}
- name: Push Docker image
run: |
Expand Down

0 comments on commit 26997ea

Please sign in to comment.