Skip to content

Commit

Permalink
Try
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob-fyi committed Oct 30, 2023
1 parent 9692228 commit fd6bac9
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 23 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ on:
- main

jobs:
test2:
uses: ortsarchiv-gemeinlebarn/automation/.github/workflows/template-standard.yml@develop
with:
production-only: true
all:
uses: ortsarchiv-gemeinlebarn/automation/.github/workflows/template-test-and-production.yml@develop
97 changes: 97 additions & 0 deletions .github/workflows/template-singular.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: OAG CI & CD Workflows - Singular Environment

on:
workflow_call:
inputs:
production-only:
required: false
type: boolean
default: false
description: If only a singular 'Prodction'-Environment exists

env:
pulledProduction: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
pushedProduction: ${{ github.ref == 'refs/heads/main' }}
pushedTest: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/bugfix/') }}

jobs:
prepare:
name: Prepate
runs-on: ubuntu-latest
steps:
- name: Download Artifact form Build
run: |
echo github.event.event_name: ${{ github.event.event_name }}
echo github.event.action: ${{ github.event.action }}
echo github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}
echo github.event.pull_request.merged: ${{ github.event.pull_request.merged }}
echo env.pulledProduction: ${{ env.pulledProduction }}
echo env.pushedProduction: ${{ env.pushedProduction }}
echo env.pushedTest: ${{ env.pulledProduction }}
# Singular

build:
name: "Build"
runs-on: windows-latest
needs: prepare
if: ${{ inputs.production-only }}
steps:
- name: Do something
run: echo 'Build Test'

deploy:
name: "Build"
runs-on: windows-latest
needs: prepare
if: ${{ inputs.production-only }}
steps:
- name: Do something
run: echo 'Build Test'

# Singular

deploy-test:
name: "[Test] Deploy"
needs: build-test
runs-on: ubuntu-latest
environment: Test
steps:
- name: Do something
run: echo 'Deploy Test'

build-test:
name: "[Test] Build"
runs-on: windows-latest
needs: prepare
if: ${{ ! inputs.production-only }}
steps:
- name: Do something
run: echo 'Build Test'

deploy-test:
name: "[Test] Deploy"
needs: build-test
runs-on: ubuntu-latest
environment: Test
steps:
- name: Do something
run: echo 'Deploy Test'

build-production:
name: "[Test] Build"
runs-on: windows-latest
needs: prepare
if: ${{ env.pulledProduction || env.pulledProduction }}
steps:
- name: Do something
run: echo 'Build Production'

deploy-production:
name: "[Test] Deploy"
needs: build-production
runs-on: ubuntu-latest
environment: Production
steps:
- name: Do something
run: echo 'Deploy Production'
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: OAG CI & CD Workflows - Standard
name: OAG CI & CD Workflows - Test & Production Environment

on:
workflow_call:
inputs:
production-only:
required: false
type: boolean
default: false
description: If only a singular 'Prodction'-Environment exists
workflow_call

env:
pulledProduction: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
Expand All @@ -16,7 +10,7 @@ env:

jobs:
prepare:
name: Prepate
name: Prepare
runs-on: ubuntu-latest
steps:
- name: Download Artifact form Build
Expand All @@ -29,15 +23,6 @@ jobs:
echo env.pushedProduction: ${{ env.pushedProduction }}
echo env.pushedTest: ${{ env.pulledProduction }}
build-test:
name: "[Test] Build"
runs-on: windows-latest
needs: prepare
if: ${{ ! inputs.production-only }}
steps:
- name: Do something
run: echo 'Build Test'

deploy-test:
name: "[Test] Deploy"
needs: build-test
Expand All @@ -47,11 +32,19 @@ jobs:
- name: Do something
run: echo 'Deploy Test'

build-test:
name: "[Test] Build"
runs-on: windows-latest
needs: prepare
if: ${{ ! inputs.production-only }}
steps:
- name: Do something
run: echo 'Build Test'

build-production:
name: "[Test] Build"
runs-on: windows-latest
needs: prepare
if: ${{ env.pulledProduction || env.pushedProduction }}
steps:
- name: Do something
run: echo 'Build Production'
Expand Down

0 comments on commit fd6bac9

Please sign in to comment.