Skip to content

Commit

Permalink
branche code can be manually deployed (for dev environment for example)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaSei committed Oct 31, 2023
1 parent 6dad7af commit 933a22e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/_service_release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Release service

on:
workflow_dispatch:
service_name:
description: 'Service name'
required: true
type: choice
options:
- a
- b

workflow_call:
inputs:
service_name:
Expand All @@ -19,9 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request.head.ref }}

- name: Build docker image
run: make build
Expand All @@ -40,6 +47,8 @@ jobs:
with:
tag_name: ${{ steps.tag_image.outputs.next_tag }}
generate_release_notes: true
prerelease: ${{ github.event_name == 'workflow_dispatch' }}


- name: Automatic deploy to Dev
if: ${{ inputs.automatic_deploy_to_dev == 'true' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ on:
environment:
description: 'Target deployment environment (dev, stage, prod)'
required: true
type: choice
options:
- dev
- stage
- prod
type: environment

workflow_call:
inputs:
checkout_ref:
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ new_version_file := /tmp/newtag.txt

new_tag:
@echo "Pulling current tags."
@git pull --ff-only --tags
@if [ -n "$$GITHUB_OUTPUT" ]; then \
echo "Pull is made by github"; \
else \
git pull --ff-only --tags; \
fi
@LATEST=`git describe --tags --always --abbrev=0 --match "a/v*" $$(git rev-list --tags --max-count=1) | sed 's/$(SERVICE_NAME)\///'`; \
echo "Latest tag: $$LATEST"; \
NEWPRE="v$$(date +'%Y').$$(date +'%m')"; \
echo "New prefix: $$NEWPRE"; \
if case $$LATEST in $$NEWPRE*) ;; *) false;; esac ; then \
echo "Incrementing patch version."; \
new_version="$${LATEST%.*}.$$(( $${LATEST##*.} + 1 ))"; \
Expand Down

0 comments on commit 933a22e

Please sign in to comment.