From ab4d8ca7f783d4c1f4737033d52f57de199b7e23 Mon Sep 17 00:00:00 2001 From: Dominik Biedebach Date: Sun, 17 Nov 2024 17:06:12 +0100 Subject: [PATCH] remove premode scripts --- .github/workflows/changesets-mode.yml | 38 --------------- scripts/manage-pre-mode.sh | 69 --------------------------- 2 files changed, 107 deletions(-) delete mode 100644 .github/workflows/changesets-mode.yml delete mode 100755 scripts/manage-pre-mode.sh diff --git a/.github/workflows/changesets-mode.yml b/.github/workflows/changesets-mode.yml deleted file mode 100644 index 76cac3722..000000000 --- a/.github/workflows/changesets-mode.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Manage Changesets Mode - -on: - push: - branches: - - main - - develop - - next - -jobs: - manage-pre-mode: - runs-on: ubuntu-latest - steps: - # Checkout the repository - - uses: actions/checkout@v3 - - # Setup Node.js - - uses: actions/setup-node@v3 - - # Install dependencies - - run: npm install - - # Run the script - - name: Run pre mode script - id: pre-mode - run: | - BRANCH=$(echo "${{ github.ref }}" | sed 's|refs/heads/||') - ./scripts/manage-pre-mode.sh "$BRANCH" - - # Commit if required - - name: Commit changes - if: env.needs_commit == 'true' - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git add .changeset/pre.json - git commit -m "Update Changesets pre-release mode" - git push \ No newline at end of file diff --git a/scripts/manage-pre-mode.sh b/scripts/manage-pre-mode.sh deleted file mode 100755 index f19e531fa..000000000 --- a/scripts/manage-pre-mode.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# Detect the branch from argument -BRANCH=$(echo "$1") - -PRE_PATH=".changeset/pre.json" - -pre_json_exists=false -is_on_tag=false -is_on_pre_mode=false - -grep -q '"mode": "pre"' "$PRE_PATH" && is_on_pre_mode=true || is_on_pre_mode=false - -if [ -f "$PRE_PATH" ]; then - pre_json_exists=true -fi - -enter_pre_mode() { - local branch="$1" - local tag="$2" - - grep -q '"tag": "'$tag'"' "$PRE_PATH" && is_on_tag=true || is_on_tag=false - - if $is_on_tag && $pre_json_exists && $is_on_pre_mode; then - echo "You are already in pre mode for '$tag' on '$branch'" - exit 0 - fi - - npx changeset pre exit - npx changeset pre enter "$tag" - - # Set needs_commit to true on github env - echo "needs_commit=true" >> $GITHUB_ENV - - echo "Entered pre mode for '$branch' on '$tag'" -} - -exit_pre_mode() { - local needs_exit=false - - grep -q '"mode": "exit"' "$PRE_PATH" && needs_exit=false || needs_exit=true - - if ! $needs_exit || ! $pre_json_exists; then - echo "You are not in pre mode" - exit 0 - fi - - npx changeset pre exit - - # Set needs_commit to true on github env - echo "needs_commit=true" >> $GITHUB_ENV - - echo "Exited pre mode" -} - -case "$BRANCH" in - develop) - enter_pre_mode "develop" "pre" - ;; - next) - enter_pre_mode "next" "next" - ;; - main) - exit_pre_mode - ;; - *) - exit 0 - ;; -esac \ No newline at end of file