Skip to content

Commit

Permalink
ci: use semantic-release plugin for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
genaris committed Mar 19, 2024
1 parent 3f23b38 commit aa552cf
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:

workflow_dispatch:

env:
DH_USERNAME: ${{secrets.DOCKER_HUB_LOGIN}}
DH_TOKEN: ${{secrets.DOCKER_HUB_PWD}}
IMAGE_NAME: '2060-service-agent'

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -64,20 +59,27 @@ jobs:
}
],
"@semantic-release/release-notes-generator",
[
"@codedependant/semantic-release-docker",
{
"dockerTags":
[
"${RELEASE_MAJOR}-${GITHUB_REF##*/}",
"${RELEASE_MAJOR}.${RELEASE_MINOR}-${GITHUB_REF##*/}",
"${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_PATCH}-${GITHUB_REF##*/}",
"$RELEASE_VERSION",
"${GITHUB_REF##*/}"
],
"dockerImage": "${IMAGE_NAME}"
}
]
]
additional-packages: |
['@codedependant/semantic-release-docker']
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_REGISTRY_PASSWORD : ${{ secrets.DOCKER_HUB_PWD }}
IMAGE_NAME: '2060-service-agent'

- run: echo ${{ steps.semantic.outputs.release-version }}

- name: Log in to Docker Hub
run: |
echo "$DH_TOKEN" | docker login -u "$DH_USERNAME" --password-stdin
- name: Build Docker image
run: |
docker build -f Dockerfile -t $DH_USERNAME/$IMAGE_NAME:$RELEASE_VERSION-${GITHUB_REF##*/} .
- name: Push Docker image to Docker Hub
run: |
docker push $DH_USERNAME/$IMAGE_NAME:$RELEASE_VERSION-${GITHUB_REF##*/}

0 comments on commit aa552cf

Please sign in to comment.