Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SW-2493 fixing-consistency-to-deployment-between-github-actions-and-bitbucket #1646

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Deploy on push to Developmnet or Staging
name: Deploy on push to Development 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"