chore(ci): add release workflow for apps and dsg with smart release notes generation #110
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DSG Version Validator | |
on: | |
pull_request: | |
branches: | |
- main | |
- master | |
env: | |
DSG_PACKAGE_JSON: packages/data-service-generator/package.json | |
jobs: | |
nx: | |
name: Nx | |
uses: ./.github/workflows/nx.template.yml | |
with: | |
nx-head: "${{ github.ref }}" | |
nx-base: "${{ github.event.repository.default_branch }}" | |
dsg-version-validator: | |
name: Validate DSG Version Bump | |
runs-on: ubuntu-latest | |
needs: nx | |
if: ${{ contains(needs.nx.outputs.affected-package-container, 'data-service-generator') }} | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- id: get-version | |
name: Get current package.json version | |
run: | | |
echo "::set-output name=version::$(cat $DSG_PACKAGE_JSON | jq -r '.version')" | |
- name: Check version is SemVer | |
shell: bash | |
run: | | |
if ! [[ "${{ steps.get-version.outputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then | |
echo "Invalid version '${{ steps.get-version.outputs.version }}'." | |
echo "Version must be a valid semver version. i.e. 1.0.0, 1.0.0-alpha.1, 1.0.0-build.1" | |
echo "See https://semver.org/ for more details." | |
exit 1 | |
fi | |
- name: Checkout target branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.base_ref }} | |
fetch-depth: 0 | |
- id: get-version-target | |
name: Get package.json version from target branch | |
run: | | |
echo "::set-output name=version::$(cat $DSG_PACKAGE_JSON | jq -r '.version')" | |
- name: Check if versions are equal | |
id: check-version | |
run: | | |
if [ "${{ steps.get-version.outputs.version }}" == "${{ steps.get-version-target.outputs.version }}" ]; then | |
echo "❌ Versions are equal. Please bump the version in $DSG_PACKAGE_JSON 😵" | |
exit 1 | |
else | |
echo "✅ Versions are not equal. All good" | |
exit 0 | |
fi | |