diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml index 8c05e3b777..5d5e81f47f 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/release-deploy.yml @@ -12,6 +12,17 @@ jobs: name: Release and Deploy runs-on: ubuntu-latest steps: + # Envs based on the current branch + - name: Branch Env + id: branch_env + run: | + echo "Running on branch " + if [ "${{ github.ref }}" == "refs/heads/develop" ]; then + echo "postfix=staging" >> $GITHUB_ENV + elif [ "${{ github.ref }}" == "refs/heads/main" ]; then + echo "postfix=production" >> $GITHUB_ENV + else + echo "postfix=staging" >> $GITHUB_ENV # # Setup Auth token to push to github packages - name: Set NPM Config @@ -73,6 +84,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 + # Docs Site - name: Build and push docs site uses: docker/build-push-action@v2 env: @@ -86,8 +98,9 @@ jobs: context: ./docs push: true tags: | - ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SAGE_DOCS }}:${{ steps.gitsha.outputs.value }}-release-${{ github.ref == "refs/heads/main" && 'production' || 'staging' }} + ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SAGE_DOCS }}:${{ steps.gitsha.outputs.value }}-release-${{ env.postfix }} + # Storybook Site - name: Build and push storybook uses: docker/build-push-action@v2 env: @@ -101,8 +114,9 @@ jobs: context: ./packages/sage-react/ push: true tags: | - ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SAGE_STORYBOOK }}:${{ steps.gitsha.outputs.value }}-release-${{ github.ref == "refs/heads/main" && 'production' || 'staging' }} + ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SAGE_STORYBOOK }}:${{ steps.gitsha.outputs.value }}-release-${{ env.postfix }} + # Sassdocs Site - name: Build and push sassdocs uses: docker/build-push-action@v2 env: @@ -116,4 +130,4 @@ jobs: context: ./packages/sage-assets/ push: true tags: | - ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SAGE_SASSDOCS }}:${{ steps.gitsha.outputs.value }}-release-${{ github.ref == "refs/heads/main" && 'production' || 'staging' }} + ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SAGE_SASSDOCS }}:${{ steps.gitsha.outputs.value }}-release-${{ env.postfix }}