Skip to content

Commit

Permalink
ci: update docker release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiD2ta committed Oct 25, 2024
1 parent 98c2871 commit 6ada0cd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
37 changes: 22 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Build and Release Docker Image
env:
DOCKER_REGISTRY: nethermind.jfrog.io

REPO_DEV: angkor-oci-local-dev
REPO_STAGING: angkor-oci-local-staging
REPO_PROD: angkor-oci-local-prod
REPO_DEV: angkor-docker-local-dev
REPO_STAGING: angkor-docker-local-staging
REPO_PROD: angkor-docker-local-prod

on:
push:
Expand All @@ -14,7 +14,7 @@ on:
workflow_dispatch:
inputs:
version:
type: string
type: choice
description: 'Environment to release to'
required: true
default: 'prod'
Expand Down Expand Up @@ -71,15 +71,21 @@ jobs:
build_docker_image:
name: Build and push Docker Image
runs-on: ubuntu-latest
needs: define_tag
env:
VERSION: ${{ steps.define_tag.outputs.tag }}
APP_NAME: ${{ github.event.repository.name }}
REPO: ${{
(github.event.inputs.version == 'dev' && env.REPO_DEV) ||
(github.event.inputs.version == 'staging' && env.REPO_STAGING) ||
env.REPO_PROD
}}
VERSION: ${{ needs.define_tag.outputs.tag }}
APP_NAME: ${{ github.event.repository.name }}
steps:
- name: Set REPO environment variable
run: |
if [[ "${{ github.event.inputs.version }}" == "dev" ]]; then
echo "REPO=${{ env.REPO_DEV }}" >> $GITHUB_ENV
elif [[ "${{ github.event.inputs.version }}" == "staging" ]]; then
echo "REPO=${{ env.REPO_STAGING }}" >> $GITHUB_ENV
else
echo "REPO=${{ env.REPO_PROD }}" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -103,17 +109,18 @@ jobs:
push: true
file: Dockerfile
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.REPO_DEV }}/${{ env.APP_NAME }}:${{ env.VERSION }}
${{ env.DOCKER_REGISTRY }}/${{ env.REPO_DEV }}/${{ env.APP_NAME }}:latest
${{ env.DOCKER_REGISTRY }}/${{ env.REPO }}/${{ env.APP_NAME }}:${{ env.VERSION }}
${{ env.DOCKER_REGISTRY }}/${{ env.REPO }}/${{ env.APP_NAME }}:latest
build-args: |
APP_NAME=${{ env.APP_NAME }}
VERSION=${{ env.VERSION }}
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build_docker_image
env:
VERSION: ${{ steps.define_tag.outputs.tag }}
VERSION: ${{ needs.define_tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -126,4 +133,4 @@ jobs:
tag: ${{env.VERSION}}
draft: false
prerelease: true
generateReleaseNotes: true
generateReleaseNotes: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build-docker: build-linux ## Build docker image
@docker build --build-arg APP_NAME=$(APP_NAME) --build-arg VERSION=$(VERSION) --build-arg ARCH=$(ARCH) -t $(APP_NAME) .

install: build ## compile the binary and copy it to PATH
@sudo cp build/sedge /usr/local/bin
@sudo cp build/$(APP_NAME) /usr/local/bin

run: build ## Compile and run the binary
@./bin/$(APP_NAME)
Expand Down

0 comments on commit 6ada0cd

Please sign in to comment.