Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.2.x backport #60: STAC-22210 Update checks #63

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions .github/actions/changeset-status/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,22 @@ runs:
fi
echo "✅ Temporary file created at: $OUTPUT"

# Run the changeset status command with relative path output
yarn changeset status ${{ inputs.args }} --output $(realpath --relative-to . "$OUTPUT")
RELATED_OUTPUT=$(realpath --relative-to . "$OUTPUT")

if [ ! -s "$OUTPUT" ]; then
echo "🚨 Error: Temporary file is empty after running 'yarn changeset status'"
exit 1
fi
# Run the changeset status command with relative path output
# and catch an error if the command fails
{ # try
CAUGHT_OUTPUT=$(yarn changeset status ${{ inputs.args }} --output $RELATED_OUTPUT 2>&1)
} || { # catch
# If the error is NOT caused by empty changesets, print the error and exit
if ! echo "$CAUGHT_OUTPUT" | grep -q "Some packages have been changed but no changesets were found"; then
echo "$CAUGHT_OUTPUT" >&2
exit 1
fi
}

# if the .releases length is greater than 0, then the changeset is ready to be released
if jq -e '.releases | length > 0' "$OUTPUT" > /dev/null; then
# if the output is not empty and the .releases length is greater than 0, then the changeset is ready to be released
if [ -s "$OUTPUT" ] && jq -e '.releases | length > 0' "$OUTPUT" > /dev/null; then
NAME=$(jq -r '.releases[0].name' "$OUTPUT")
TYPE=$(jq -r '.releases[0].type' "$OUTPUT")
OLD_VERSION=$(jq -r '.releases[0].oldVersion' "$OUTPUT")
Expand All @@ -56,6 +62,10 @@ runs:
echo "type=$TYPE" >> $GITHUB_OUTPUT
echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT

# print the github output
echo "📦 Changeset found:"
cat $GITHUB_OUTPUT
else
echo "⏩ No changeset found"
fi
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,11 @@ jobs:

echo "✅ Detected '$VERSION_TYPE' bump."

- name: Detect File Changes
id: changed-files
uses: tj-actions/changed-files@v41
with:
files_yaml: |
eslint_config:
- .eslintrc.js
- .eslintignore
- yarn.lock
eslint_target:
- '**/*.{ts,js,vue}'

- name: Lint all files
if: ${{ github.event_name == 'push' || steps.changed-files.outputs.eslint_config_any_changed == 'true' }}
run: yarn lint .
- name: Run typecheck
run: yarn typecheck

- name: Lint changed files
if: ${{ steps.lint-all.outcome == 'skipped' && steps.changed-files.outputs.eslint_target_any_changed == 'true' }}
run: yarn lint ${{ steps.changed-files.outputs.eslint_target_all_changed_files }} --no-error-on-unmatched-pattern
- name: Run lint
run: yarn lint .

- name: Build Observability Package
run: yarn build-pkg observability
Expand All @@ -109,6 +95,19 @@ jobs:
id: changeset-status
uses: ./.github/actions/changeset-status

- name: Check if Version Already Exists
if: steps.changeset-status.outputs.new_version
run: |
NAME="${{ steps.changeset-status.outputs.name }}"
NEW_VERSION="${{ steps.changeset-status.outputs.new_version }}"

# Check that a tag for the new version does not already exist
if [[ ! -z $(git tag -l "$NAME@$NEW_VERSION") ]]; then
echo "🚨 The version '$NAME@$NEW_VERSION' already exists."
echo "🚨 Please ensure that the version bump and the base branch is correct."
exit 1
fi

# creates a PR if there are changesets or assign the new tag if the PR is merged
- name: Create Release Pull Request or Publish
id: changesets
Expand Down Expand Up @@ -145,7 +144,7 @@ jobs:

- name: Upload Charts Artifact
if: steps.prepare-artifact.conclusion == 'success'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: charts
path: tmp
Expand Down Expand Up @@ -175,7 +174,7 @@ jobs:
version: v3.8.0

- name: Download Build Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: charts

Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},
"typescript.tsdk": "node_modules/typescript/lib"
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"lint": "eslint --ext .ts,.js,.vue",
"dev": "NODE_ENV=dev vue-cli-service serve",
"build": "vue-cli-service build",
"typecheck": "yarn workspaces run typecheck",
"clean": "./node_modules/@rancher/shell/scripts/clean",
"build-pkg": "./node_modules/@rancher/shell/scripts/build-pkg.sh",
"serve-pkgs": "./node_modules/@rancher/shell/scripts/serve-pkgs",
Expand All @@ -32,6 +33,6 @@
"release-tag": "changeset tag && ./scripts/duplicate-release-tags.sh"
},
"devDependencies": {
"@changesets/cli": "^2.27.9"
"@changesets/cli": "^2.27.11"
}
}
1 change: 1 addition & 0 deletions pkg/observability/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"icon": "https://raw.githubusercontent.com/stackvista/rancher-extension-stackstate/main/pkg/observability/rancher-observability.svg",
"scripts": {
"typecheck": "tsc --noEmit --skipLibCheck",
"dev": "./node_modules/.bin/nuxt dev",
"nuxt": "./node_modules/.bin/nuxt"
},
Expand Down
1 change: 0 additions & 1 deletion pkg/observability/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"node",
"webpack-env",
"@types/node",
"@types/jest",
"@types/lodash",
"rancher",
"shell"
Expand Down
42 changes: 0 additions & 42 deletions tsconfig.json

This file was deleted.

Loading
Loading