Skip to content

Commit

Permalink
feat: split dev and prod workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiStefanie committed Nov 30, 2022
1 parent 5a4d166 commit 29b8157
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 31 deletions.
40 changes: 9 additions & 31 deletions .github/workflows/main.yml → .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Main
name: Deploy to dev

on:
# push:
Expand All @@ -17,43 +17,21 @@ permissions:
jobs:
release:
runs-on: ubuntu-latest
name: Semantic Release
environment: development
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v32
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Copy
env:
AZ_ST_CONN_STRING: ${{ secrets.DEV_AZ_ST_CONN_STRING }}
uses: azure/CLI@v1
with:
azcliversion: 2.37.0
inlineScript: |
az storage blob upload-batch --connection-string $(echo "$AZ_ST_CONN_STRING" | base64 -d) --destination grc/queries --source ./queries --overwrite
az storage blob upload-batch --connection-string $(echo "$AZ_ST_CONN_STRING" | base64 -d) --destination grc/controls --source ./controls --overwrite
- name: Update
shell: bash
env:
BAPI_GRC_UPDATE_ENDPOINT: ${{ secrets.DEV_BAPI_GRC_UPDATE_ENDPOINT }}
INTERNAL_API_KEY: ${{ secrets.DEV_INTERNAL_API_KEY }}
run: |
curl --silent --show-error --fail -X POST $BAPI_GRC_UPDATE_ENDPOINT -H "Content-Type:application/json" -H "x-api-key:$(echo "$INTERNAL_API_KEY" | base64 -d)" -d '{"accounts":"all"}'
- name: 'Tag Release'
- name: 'Semantic Release'
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: true
force-bump-patch-version: true
prod:
deploy:
runs-on: ubuntu-latest
environment: production
name: Deploy GRC to dev
environment: development
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -67,7 +45,7 @@ jobs:
done
- name: Copy
env:
AZ_ST_CONN_STRING: ${{ secrets.PROD_AZ_ST_CONN_STRING }}
AZ_ST_CONN_STRING: ${{ secrets.DEV_AZ_ST_CONN_STRING }}
uses: azure/CLI@v1
with:
azcliversion: 2.37.0
Expand All @@ -77,7 +55,7 @@ jobs:
- name: Update
shell: bash
env:
BAPI_GRC_UPDATE_ENDPOINT: ${{ secrets.PROD_BAPI_GRC_UPDATE_ENDPOINT }}
INTERNAL_API_KEY: ${{ secrets.PROD_INTERNAL_API_KEY }}
BAPI_GRC_UPDATE_ENDPOINT: ${{ secrets.DEV_BAPI_GRC_UPDATE_ENDPOINT }}
INTERNAL_API_KEY: ${{ secrets.DEV_INTERNAL_API_KEY }}
run: |
curl --silent --show-error --fail -X POST $BAPI_GRC_UPDATE_ENDPOINT -H "Content-Type:application/json" -H "x-api-key:$(echo "$INTERNAL_API_KEY" | base64 -d)" -d '{"accounts":"all"}'
41 changes: 41 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy to prod

on:
workflow_dispatch:

permissions:
id-token: write
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy GRC to prod
environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v32
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Copy
env:
AZ_ST_CONN_STRING: ${{ secrets.PROD_AZ_ST_CONN_STRING }}
uses: azure/CLI@v1
with:
azcliversion: 2.37.0
inlineScript: |
az storage blob upload-batch --connection-string $(echo "$AZ_ST_CONN_STRING" | base64 -d) --destination grc/queries --source ./queries --overwrite
az storage blob upload-batch --connection-string $(echo "$AZ_ST_CONN_STRING" | base64 -d) --destination grc/controls --source ./controls --overwrite
- name: Update
shell: bash
env:
BAPI_GRC_UPDATE_ENDPOINT: ${{ secrets.PROD_BAPI_GRC_UPDATE_ENDPOINT }}
INTERNAL_API_KEY: ${{ secrets.PROD_INTERNAL_API_KEY }}
run: |
curl --silent --show-error --fail -X POST $BAPI_GRC_UPDATE_ENDPOINT -H "Content-Type:application/json" -H "x-api-key:$(echo "$INTERNAL_API_KEY" | base64 -d)" -d '{"accounts":"all"}'

0 comments on commit 29b8157

Please sign in to comment.