Skip to content
Merged
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
27 changes: 22 additions & 5 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
branches:
- main
- master
- 'release/**'
- 'poc/**'
pull_request:
branches:
- main
- master
workflow_dispatch:

# Disable concurrent builds
concurrency:
Expand All @@ -22,8 +22,25 @@ concurrency:
# https://github.com/marketplace/actions/slack-send

jobs:
validate-tag:
name: Validate Release Tag
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Check tag matches semver
env:
TAG: ${{ github.ref_name }}
run: |
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.]+)?$ ]]; then
echo "Tag '$TAG' is not a valid semver tag (expected vX.Y.Z or vX.Y.Z-suffix)" >&2
exit 1
fi
echo "Tag '$TAG' is valid semver"

test-portal-generator:
name: Test Portal Generator
needs: validate-tag
if: always() && (needs.validate-tag.result == 'success' || needs.validate-tag.result == 'skipped')
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -235,8 +252,8 @@ jobs:
name: Deploy to Production
needs: validate-specs
runs-on: ubuntu-latest
# Only run on release branches (release/*)
if: startsWith(github.ref, 'refs/heads/release/')
# Only run against a release tag (vX.Y.Z), dispatched manually via workflow_dispatch
if: startsWith(github.ref, 'refs/tags/')
environment:
name: production
url: https://dev-portal.mulesoft.com
Expand Down Expand Up @@ -284,11 +301,11 @@ jobs:

notify-on-failure:
name: Notify on Failure
needs: [test-portal-generator, generate-portal, validate-specs, deploy-to-test, deploy-to-production]
needs: [validate-tag, test-portal-generator, generate-portal, validate-specs, deploy-to-test, deploy-to-production]
runs-on: ubuntu-latest
if: |
failure() &&
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/'))
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))

steps:
- name: Send Slack notification
Expand Down
Loading