Skip to content
Open
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
64 changes: 64 additions & 0 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish Preview

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
preview:
name: Publish preview to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run lint
run: yarn lint

- name: TypeScript check
run: yarn tsc

- name: Run tests
run: yarn test --ci

- name: Build package
run: yarn build

- name: Set preview version
id: version
run: |
# Get current version and create preview version with PR number and short SHA
CURRENT_VERSION=$(node -p "require('./package.json').version")
SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7)
PREVIEW_VERSION="${CURRENT_VERSION}-pr.${{ github.event.pull_request.number }}.${SHORT_SHA}"
echo "preview_version=$PREVIEW_VERSION" >> $GITHUB_OUTPUT
npm version "$PREVIEW_VERSION" --no-git-tag-version

- name: Publish preview to NPM
run: npm publish --provenance --access public --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Comment on PR
uses: actions/github-script@v7
env:
PREVIEW_VERSION: ${{ steps.version.outputs.preview_version }}
with:
script: |
const script = require('./scripts/comment-pr-preview.js');
await script({ github, context });
129 changes: 129 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Publish Release

on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
# Publish on GitHub Release (manual release via UI)
publish-on-release:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run lint
run: yarn lint

- name: TypeScript check
run: yarn tsc

- name: Run tests
run: yarn test --ci

- name: Build package
run: yarn build

- name: Set version from tag
run: |
# Extract version from tag (removes 'v' prefix if present)
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
npm version "$VERSION" --no-git-tag-version --allow-same-version

- name: Publish to NPM
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Production release - manual workflow trigger
release:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run lint
run: yarn lint

- name: TypeScript check
run: yarn tsc

- name: Run tests
run: yarn test --ci

- name: Build package
run: yarn build

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Bump version
id: version
run: |
NEW_VERSION=$(npm version ${{ inputs.version }} --no-git-tag-version)
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Commit version bump
run: |
git add package.json
git commit -m "chore(release): ${{ steps.version.outputs.new_version }}"
git tag ${{ steps.version.outputs.new_version }}

- name: Publish to NPM
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push changes
run: git push --follow-tags

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.new_version }}
generate_release_notes: true
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2025-01-27

### Added

- Initial release of the Flagsmith Backstage plugin
- **FlagsTab** - Full-page feature flags view with:
- Searchable table with pagination (10/25/50/100 items per page)
- Environment status columns with toggle switches (up to 6 environments)
- Tags column with overflow indicator (+N for >3 tags)
- Expandable rows with detailed feature information
- Usage analytics chart per environment (last 30 days)
- Version info, ownership details, and scheduled changes indicators
- **FlagsmithOverviewCard** - Compact card showing flag statistics
- **FlagsmithUsageCard** - Usage metrics chart for the last 30 days
- Proxy-based API architecture for secure Flagsmith API access
- Support for Backstage new frontend system
- Comprehensive test coverage for hooks and utilities

### Technical

- `FlagsmithClient` - API client with lazy loading for feature details
- Shared components: `LoadingState`, `ErrorState`, `EmptyState`, `SearchInput`, `FlagsmithLink`
- Utility functions for date formatting, flag type detection, and pagination
- TypeScript strict mode compliance

[Unreleased]: https://github.com/Flagsmith/flagsmith-backstage-plugin/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/Flagsmith/flagsmith-backstage-plugin/releases/tag/v0.1.0
Loading