Skip to content

Commit

Permalink
final?
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Jan 23, 2024
1 parent 66ee6e5 commit da79968
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 66 deletions.
55 changes: 27 additions & 28 deletions .github/workflows/call_release_function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,37 @@ on:
environment:
type: string
required: true
branch:
short_env:
type: string
required: false
default: main
required: true

jobs:
release:
name: 'Build & Release'
runs-on: ubuntu-20.04
environment:
name: ${{ inputs.environment }}-cd
url: ${{ format('https://selc-{0}-onboarding-fn.azurewebsites.net', inputs.environment[0]) }}
url: ${{ format('https://selc-{0}-onboarding-fn.azurewebsites.net', inputs.short_env) }}
permissions:
id-token: write
packages: read

steps:

# - name: Setup Maven Action
# uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # v1.11.0
# with:
# checkout-fetch-depth: 0
# java-version: 17
# java-distribution: 'temurin'
# maven-version: '3.9.5'
# cache-enabled: true
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # v1.11.0
with:
checkout-fetch-depth: 0
java-version: 17
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

# - name: Build Functions App
# shell: bash
# run: |
# mvn --projects :onboarding-functions --also-make package install -DskipTests \
# -Dquarkus.azure-functions.app-name=${{ vars.AZURE_ONBOARDING_FN_APP_NAME }}
- name: Build Functions App
shell: bash
run: |
mvn --projects :onboarding-functions --also-make package install -DskipTests \
-Dquarkus.azure-functions.app-name=${{ vars.AZURE_ONBOARDING_FN_APP_NAME }}
- name: Log in to Azure
uses: azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
Expand All @@ -44,14 +43,14 @@ jobs:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

# - name: Deploy Function App
# shell: bash
# working-directory: apps/onboarding-functions
# run: |
# mvn -f pom.xml quarkus:deploy \
# -Dquarkus.azure-functions.app-name=${{ vars.AZURE_ONBOARDING_FN_APP_NAME }} \
# -Dquarkus.azure-functions.subscription-id=${{ secrets.AZURE_SUBSCRIPTION_ID }} \
# -Dquarkus.azure-functions.resource-group=${{ vars.AZURE_ONBOARDING_FN_RESOURCE_GROUP }} \
# -Dquarkus.azure-functions.region=westeurope \
# -Dquarkus.azure-functions.app-service-plan-name=${{ vars.AZURE_ONBOARDING_FN_SERVICE_PLAN }} \
# -Dquarkus.azure-functions.runtime.java-version=17
- name: Deploy Function App
shell: bash
working-directory: apps/onboarding-functions
run: |
mvn -f pom.xml quarkus:deploy \
-Dquarkus.azure-functions.app-name=${{ vars.AZURE_ONBOARDING_FN_APP_NAME }} \
-Dquarkus.azure-functions.subscription-id=${{ secrets.AZURE_SUBSCRIPTION_ID }} \
-Dquarkus.azure-functions.resource-group=${{ vars.AZURE_ONBOARDING_FN_RESOURCE_GROUP }} \
-Dquarkus.azure-functions.region=westeurope \
-Dquarkus.azure-functions.app-service-plan-name=${{ vars.AZURE_ONBOARDING_FN_SERVICE_PLAN }} \
-Dquarkus.azure-functions.runtime.java-version=17
49 changes: 11 additions & 38 deletions .github/workflows/release_functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,66 +4,39 @@ on:
push:
branches:
- main
- releases/**
- EC-97-pipeline-function-app-deployment-aggiunta-supporto-ambienti-e-branch # TODO: remove
# paths:
# - 'apps/onboarding-functions/**'
# - "apps/pom.xml"
# - "pom.xml"

# New branch created from main, deploy it in UAT
workflow_run:
workflows:
- "Create Release"
types:
- completed

# deploy UAT when create a new branch release*, condition below contains() permit to execute worflow only for 'release' branch
# create:
- releases/*
paths:
- 'apps/onboarding-functions/**'
- "apps/pom.xml"
- "pom.xml"

workflow_dispatch:

jobs:

# environment:
# uses: ./.github/workflows/call_read_environment.yml
# name: GitHub Environment

# release:
# uses: ./.github/workflows/call_release_function.yml
# name: OnBoarding function Release
# needs: [environment]
# secrets: inherit
# with:
# environment: ${{ needs.environment.outputs.env_name }}

# ---

release_dev:
uses: ./.github/workflows/call_release_function.yml
name: '[Dev] OnBoarding function Release'
# needs: [environment] TODO: change
# if: github.ref_name == 'main'
if: startsWith(github.ref_name, 'ec-97')
if: github.ref_name == 'main'
secrets: inherit
with:
environment: dev
short_env: d

release_uat:
uses: ./.github/workflows/call_release_function.yml
name: '[UAT] OnBoarding function Release'
needs: [release_dev] # TODO: change
if: startsWith(github.ref_name, 'ec-97')
if: startsWith(github.ref_name, 'releases/')
secrets: inherit
with:
environment: uat
short_env: u

release_prod:
uses: ./.github/workflows/call_release_function.yml
name: '[Prod] OnBoarding function Release'
needs: [release_uat]
if: (needs.release_uat.result == 'skipped' || needs.release_uat.result == 'success') && startsWith(github.ref_name, 'ec-97')
# if: startsWith(github.ref_name, 'releases/')
if: startsWith(github.ref_name, 'releases/')
secrets: inherit
with:
environment: prod
short_env: p

0 comments on commit da79968

Please sign in to comment.