diff --git a/.github/workflows/_service_release.yaml b/.github/workflows/_service_release.yaml index b9132f7..3d2af51 100644 --- a/.github/workflows/_service_release.yaml +++ b/.github/workflows/_service_release.yaml @@ -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: @@ -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 @@ -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' }} diff --git a/.github/workflows/release.yaml b/.github/workflows/deploy.yaml similarity index 95% rename from .github/workflows/release.yaml rename to .github/workflows/deploy.yaml index e00fb64..5e28928 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/deploy.yaml @@ -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: diff --git a/Makefile b/Makefile index 076ca7e..47a6ec5 100644 --- a/Makefile +++ b/Makefile @@ -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 ))"; \