From e905784be5c62fe17e87cfa136542aa6def6a981 Mon Sep 17 00:00:00 2001 From: Shai Reznik Date: Sun, 28 Jul 2024 16:09:25 +0300 Subject: [PATCH] ci: testing is_release flag --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++ .mock_changesets/fake_change.md | 1 + 2 files changed, 38 insertions(+) create mode 100644 .mock_changesets/fake_change.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7334de7698f..791a646085a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,7 @@ jobs: build-insights: ${{ steps.cache-insights.outputs.cache-hit != 'true' }} build-unit: ${{ steps.cache-unit.outputs.cache-hit != 'true' }} build-e2e: ${{ steps.cache-e2e.outputs.cache-hit != 'true' }} + is_release: ${{ steps.check_changesets.outputs.is_release }} steps: - name: Branch @@ -72,6 +73,34 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Check for removed .mock_changesets files and directory contents + id: check_changesets + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: | + is_release=false + removed_files="${{ github.event.head_commit.removed }}" + + echo "Removed files: $removed_files" + + md_file_removed=false + for file in $removed_files; do + if [[ $file == .mock_changesets/*.md ]]; then + md_file_removed=true + break + fi + done + + if [ -d ".mock_changesets" ]; then + md_files=$(find .mock_changesets -name '*.md') + if [ -z "$md_files" ] && [ "$md_file_removed" = true ]; then + is_release=true + fi + elif [ "$md_file_removed" = true ]; then + is_release=true + fi + + echo "is_release=${is_release}" >> $GITHUB_ENV + - run: jq .scripts package.json > scripts.json - name: 'check cache: qwik' @@ -138,6 +167,14 @@ jobs: path: e2e-tests-completed.txt key: ${{ hashfiles('others-key.txt', 'starters/e2e/**/*', 'starters/apps/e2e/**/*') }} + log_is_release: + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + runs-on: ubuntu-latest + needs: changes + steps: + - name: Log is_release + run: echo "is_release=${{ needs.changes.outputs.is_release }}" + ############ BUILD Qwik ############ build-qwik: if: needs.changes.outputs.build-qwik == 'true' diff --git a/.mock_changesets/fake_change.md b/.mock_changesets/fake_change.md new file mode 100644 index 00000000000..de967989bdc --- /dev/null +++ b/.mock_changesets/fake_change.md @@ -0,0 +1 @@ +# Fake change \ No newline at end of file