Update README.md #196
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: Trigger Releases | |
on: | |
push: | |
branches: main | |
jobs: | |
check-changes: | |
runs-on: ubuntu-latest | |
name: Check Changed Files | |
outputs: | |
modules: ${{ steps.build-matrix.outputs.modules }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: packages/**/package.json | |
- name: Build matrix input | |
id: build-matrix | |
if: ${{ steps.changed-files.outputs.all_changed_files }} != '[]' | |
run: | | |
set +e | |
modules_list=() | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
./bin/check-version-bump.sh ./"$file" | |
# check-version-bump exits with 0 if it detects a bump, otherwise with 1 | |
if [ $? != "1" ] && [[ ! " ${modules_list[*]} " =~ " ${file} " ]]; then | |
modules_list+=("${file%"/package.json"}") | |
fi | |
done | |
jsonString="$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modules_list[@]}")" | |
echo "modules=$jsonString" >> $GITHUB_OUTPUT | |
trigger-lint: | |
name: Run Lint Checks | |
needs: [ check-changes ] | |
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }} | |
uses: ./.github/workflows/lint.yml | |
trigger-unit-tests: | |
name: Run Unit Tests | |
needs: [ check-changes ] | |
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }} | |
uses: ./.github/workflows/unit-test.yml | |
secrets: inherit | |
trigger-releases: | |
name: Trigger releases | |
needs: [ check-changes, trigger-lint, trigger-unit-tests ] | |
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }} | |
permissions: write-all | |
strategy: | |
matrix: | |
module: ${{ fromJSON(needs.check-changes.outputs.modules) }} | |
uses: ./.github/workflows/create-release.yml | |
with: | |
module: ${{ matrix.module }} | |
secrets: inherit | |