Skip to content

Commit

Permalink
Envs.
Browse files Browse the repository at this point in the history
  • Loading branch information
antejavor committed Sep 16, 2024
1 parent ff0619e commit a69cb6f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ on:
type: boolean
required: false
default: false

push:

jobs:
build-and-push:
runs-on: ubuntu-latest
env:
DOCKER_ORGANIZATION_NAME: memgraph
DOCKER_REPOSITORY_NAME: mgconsole-test
DOCKER_ORGANIZATION_NAME: memgraph
DOCKER_REPOSITORY_NAME: mgconsole-test
VERSION: ${{ github.event.inputs.version || '0.0.1' }}
FORCE_RELEASE: ${{ github.event.inputs.force_release || 'false' }}

steps:
- name: Checkout repository
Expand All @@ -34,12 +37,13 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Check if specified version is already pushed
if: github.event_name == 'workflow_dispatch'
run: |
EXISTS=$(docker manifest inspect $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} > /dev/null; echo $?)
EXISTS=$(docker manifest inspect $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ env.VERSION }} > /dev/null; echo $?)
echo $EXISTS
if [[ ${EXISTS} -eq 0 ]]; then
echo 'The specified version has been already released to DockerHub.'
if [[ ${{ github.event.inputs.force_release }} == 'true' ]]; then
if [[ ${{ env.FORCE_RELEASE }} == 'true' ]]; then
echo 'Forcing the release!'
else
echo 'Stopping the release!'
Expand All @@ -53,12 +57,12 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
push: true
push: ${{ github.event_name == 'workflow_dispatch' }}
tags: |
$DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }}
$DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ env.VERSION }}
$DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:latest
platforms: linux/amd64,linux/arm64

- name: Verify Docker image
run: |
docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} uname -m
docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ env.VERSION }} uname -m

0 comments on commit a69cb6f

Please sign in to comment.