v0.2.0 user-specific configuration management #16
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: Pre-Publish Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
jobs: | |
prettier-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Run Prettier check | |
run: npm run format-check | |
test: | |
runs-on: ubuntu-latest | |
needs: prettier-check | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Set environment variables | |
run: echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV | |
- name: Run tests | |
run: npm test | |
- name: Generate coverage report | |
run: npm test -- --coverage | |
- name: Upload coverage report | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage/lcov-report | |
build: | |
runs-on: ubuntu-latest | |
needs: prettier-check | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Check version bump | |
env: | |
BASE_BRANCH: main | |
run: | | |
git fetch origin $BASE_BRANCH | |
BASE_VERSION=$(git show origin/$BASE_BRANCH:package.json | jq -r '.version') | |
CURRENT_VERSION=$(jq -r '.version' package.json) | |
echo "Base branch version: $BASE_VERSION" | |
echo "Current branch version: $CURRENT_VERSION" | |
if [ "$CURRENT_VERSION" == "$BASE_VERSION" ]; then | |
echo "Error: Version number has not been increased." | |
exit 1 | |
elif ! npx semver $CURRENT_VERSION -g $BASE_VERSION; then | |
echo "Error: Version number is not greater than the base branch." | |
exit 1 | |
else | |
echo "Version check passed." | |
fi | |
- name: Run build | |
run: npm run build |