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 9296363 commit f79767a
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/template-test-and-production.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
name: OAG CI & CD Workflows - Test & Production Environment

on:
workflow_call

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/') }}
workflow_call

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
deployTest: ${{ steps.setup.outputs.DEPLOY_TEST }}
deployProduction: ${{ steps.setup.outputs.DEPLOY_PRODUCTION }}
steps:
- name: Download Artifact form Build
- id: setup
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 }}
echo github.ref: ${{ github.ref }}
echo "DEPLOY_TEST=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/bugfix/') }}" >> "$GITHUB_OUTPUT"
echo "DEPLOY_PRODUCTION=${{ (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || github.ref == 'refs/heads/main' }}" >> "$GITHUB_OUTPUT"
deploy-test:
name: "[Test] Deploy"
needs: build-test
runs-on: ubuntu-latest
environment: Test
steps:
- name: Do something
run: echo 'Deploy Test'
# Test Environment

build-test:
name: "[Test] Build"
runs-on: windows-latest
needs: prepare
if: ${{ needs.prepare.outputs.deployTest }}
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'

# Production Environment

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

deploy-production:
name: "[Test] Deploy"
name: "[Production] Deploy"
needs: build-production
runs-on: ubuntu-latest
environment: Production
Expand Down

0 comments on commit f79767a

Please sign in to comment.