Skip to content

Commit

Permalink
[PAGOPA-2282] ci: Update release action
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-ang committed Oct 24, 2024
1 parent a5bcc35 commit 8349e18
Showing 1 changed file with 42 additions and 15 deletions.
57 changes: 42 additions & 15 deletions .github/workflows/04_release_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ on:
- dev
- uat
- prod
semver:
version:
required: false
type: choice
description: Select the version
options:
- ''
- skip
- promote
- patch
- skip_or_promote
- new_release
- breaking_change
beta:
Expand All @@ -40,10 +38,6 @@ on:
environment:
required: true
type: string
semver:
required: true
type: string
default: skip

permissions:
packages: write
Expand All @@ -59,14 +53,47 @@ jobs:
name: Setup
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.semver_setup.outputs.semver }}
environment: ${{ steps.semver_setup.outputs.environment }}
semver: ${{ steps.get_semver.outputs.semver }}
environment: ${{ steps.get_env.outputs.environment }}
steps:
- name: Semver setup
id: semver_setup
uses: pagopa/github-actions-template/nodo5-semver-setup@ce252c8501c9242bd6045f7cdd650736b2f38777
with:
semver: ${{ inputs.semver }}
- name: pull request rejected
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged != true
run: |
echo "❌ PR was closed without a merge"
exit 1
# Set Semvar
- run: echo "SEMVER=patch" >> $GITHUB_ENV

- if: ${{ (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'breaking-change')) }}
run: echo "SEMVER=major" >> $GITHUB_ENV

# force semver if dev, !=main or skip release
- if: ${{ inputs.version == 'new_release' }}
run: echo "SEMVER=minor" >> $GITHUB_ENV

- if: ${{ inputs.version == 'breaking_change' }}
run: echo "SEMVER=major" >> $GITHUB_ENV

- if: ${{ github.ref_name != 'main' }}
run: echo "SEMVER=buildNumber" >> $GITHUB_ENV

- if: ${{ inputs.version == 'skip_or_promote' }}
run: echo "SEMVER=skip" >> $GITHUB_ENV

- id: get_semver
name: Set Output
run: echo "semver=${{env.SEMVER}}" >> $GITHUB_OUTPUT

# Set Environment
- run: echo "ENVIRNOMENT=${{ inputs.environment}}" >> $GITHUB_ENV

- if: ${{ inputs.environment == null }}
run: echo "ENVIRNOMENT=dev" >> $GITHUB_ENV

- id: get_env
name: Set Output
run: echo "environment=${{env.ENVIRNOMENT}}" >> $GITHUB_OUTPUT

release:
needs: [setup]
Expand Down

0 comments on commit 8349e18

Please sign in to comment.