From cad4d94bccf58eee026e8b6e253e57dbb7eb77a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ti=E1=BA=BFn=20Nguy=E1=BB=85n=20Kh=E1=BA=AFc?= Date: Sun, 24 Nov 2024 22:32:53 +1300 Subject: [PATCH] ci: disable snapshot publishing (#363) This is only useful early on --- .github/workflows/snapshot-publishing.yml | 26 ---------- scripts/publish-snapshot.sh | 62 ----------------------- 2 files changed, 88 deletions(-) delete mode 100644 .github/workflows/snapshot-publishing.yml delete mode 100755 scripts/publish-snapshot.sh diff --git a/.github/workflows/snapshot-publishing.yml b/.github/workflows/snapshot-publishing.yml deleted file mode 100644 index 543c5e28..00000000 --- a/.github/workflows/snapshot-publishing.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Snapshot publishing - -on: - push: - branches: [main] - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - # https://github.com/yarnpkg/berry/issues/4014 - fetch-depth: 0 - - - uses: ./.github/actions/setup - - - run: yarn build:packages - - - run: yarn workspaces foreach -At --no-private version 0.0.0-snapshot.${{ github.run_number }}+$(git rev-parse --short HEAD) --immediate - - - run: scripts/publish-snapshot.sh - env: - YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/publish-snapshot.sh b/scripts/publish-snapshot.sh deleted file mode 100755 index eaa46f79..00000000 --- a/scripts/publish-snapshot.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -e - -# Check if LICENSE file exists in the root directory -if [ ! -f LICENSE ]; then - echo "LICENSE file not found in the root directory." - exit 1 -fi - -# Check if .gitignore file exists -if [ ! -f .gitignore ]; then - echo ".gitignore file not found in the root directory." - exit 1 -fi - -# Read .gitignore into an array, ignoring comments and empty lines -gitignore_patterns=() -while IFS= read -r line; do - # Ignore comments and empty lines - [[ "$line" =~ ^#.*$ || -z "$line" ]] && continue - gitignore_patterns+=("$line") -done <.gitignore - -# Create an array to keep track of created LICENSE files -created_files=() - -# Function to check if a path matches any .gitignore pattern -is_ignored() { - local path=$1 - for pattern in "${gitignore_patterns[@]}"; do - if [[ $path == $pattern || $path == $pattern/* ]]; then - return 0 - fi - done - return 1 -} - -# Find all directories containing a package.json file -while IFS= read -r -d '' package_json; do - dir=$(dirname "$package_json") - # Check if directory is ignored - if ! is_ignored "$dir"; then - # Check if LICENSE file already exists in the directory - if [ ! -f "$dir/LICENSE" ]; then - # Copy the LICENSE file to the directory - cp LICENSE "$dir" - created_files+=("$dir/LICENSE") - echo "Copied LICENSE to $dir" - fi - fi -done < <(find . -name package.json -type f -not -path "*/node_modules/*" -print0) - -yarn workspaces foreach -At --no-private npm publish --access public --tag snapshot --tolerate-republish - -# Delete only the created LICENSE files -for file in "${created_files[@]}"; do - if [ -f "$file" ]; then - rm "$file" - echo "Deleted $file" - fi -done