Skip to content

Commit

Permalink
SW-2493-fixing-consistency-to-deployment-between-github-actions-and-b…
Browse files Browse the repository at this point in the history
…itbucket

* Added .jira/config.yml
* Modified the deployment-on-push.yml to include push to stable and deploy to staging
* Modified Envirnmnet names to start with upper case letter
  • Loading branch information
ahmed-mrbeam committed Jan 4, 2023
1 parent fdbf873 commit d937643
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Deployment workflow to be used for Jira reporting
name: Deploy alpha to Development
name: Deploy on push to Developmnet or Staging

on:
push:
branches: ["alpha"]
branches: ["alpha", "stable"]

workflow_dispatch:

Expand All @@ -14,41 +14,57 @@ permissions:
id-token: write

jobs:
deploy-dev:
name: Deploy to Dev environment
deploy:
name: Deploy on push
# IMPORTANT: the workflow must have write access to deployments, otherwise the action will fail.
permissions:
deployments: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check branch name
id: check-branch-name
run: |
if [ ${{ github.ref_name }} == "alpha" ]; then
echo 'DEPLOY_ENVIRONMENT=Development' >> $GITHUB_OUTPUT
echo " Deploying to Development environment"
elif [ ${{ github.ref_name }} == "stable" ]; then
echo 'DEPLOY_ENVIRONMENT=Staging' >> $GITHUB_OUTPUT
echo " Deploying to Staging environment"
else
echo 'DEPLOY_ENVIRONMENT=none' >> $GITHUB_OUTPUT
echo " Branch name: ${{ github.ref_name }} not supported, Exiting"
exit 1
fi
- uses: chrnorm/deployment-action@v2
name: Create GitHub deployment
id: deployment-dev
id: deployment
with:
token: '${{ github.token }}'
environment: development
environment: ${{steps.check-branch-name.outputs.DEPLOY_ENVIRONMENT}}

- name: Update deployment status (success)
if: ${{ success() }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
state: 'success'
deployment-id: ${{ steps.deployment-dev.outputs.deployment_id }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

- name: Update deployment status (failure)
if: ${{ failure() }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
state: 'failure'
deployment-id: ${{ steps.deployment-dev.outputs.deployment_id }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

- name: Update deployment status (cancelled)
if: ${{ cancelled() }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
state: 'cancelled'
deployment-id: ${{ steps.deployment-dev.outputs.deployment_id }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
6 changes: 3 additions & 3 deletions .github/workflows/deployment-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:
id: set_release_env
run: |
if [ ${{ steps.regex-match-alpha-release.outputs.match }} != "" ]; then
echo 'deployment-env=alpha' >> $GITHUB_OUTPUT
echo 'deployment-env=Alpha' >> $GITHUB_OUTPUT
elif [ ${{ steps.regex-match-beta-release.outputs.match }} != "" ]; then
echo 'deployment-env=beta' >> $GITHUB_OUTPUT
echo 'deployment-env=Beta' >> $GITHUB_OUTPUT
elif [ ${{ steps.regex-match-prod-release.outputs.match }} != "" ]; then
echo 'deployment-env=production' >> $GITHUB_OUTPUT
echo 'deployment-env=Production' >> $GITHUB_OUTPUT
else
echo 'deployment-env=unknown' >> $GITHUB_OUTPUT
echo 'release name unrecognized: ${{ github.ref_name }}'
Expand Down
11 changes: 11 additions & 0 deletions .jira/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
deployments:
environmentMapping:
development:
- "Development"
testing:
- "Alpha"
- "Beta"
staging:
- "Staging"
production:
- "Production"

0 comments on commit d937643

Please sign in to comment.