Files
vercel__flags/.github/workflows/release-snapshot.yaml
Andy 2fcc446ea8 Create LaunchDarkly adapter (#2)
* Create LaunchDarkly adapter

* Update example to include a LaunchDarkly flag

* Add missing env to turbo

* Rename to defaultLaunchDarklyAdapter

* Add winter sale example for providers

* Update winter-sale

* Document usage in readme

* Allow to set the default value through the adapter

* Fix readme

* Add default value for adapter

* Make argument optional

* Add @ts-expect-error

* Add a LaunchDarkly adapter (#10)

* add ld example

* reword

* remove winter-sale example

* remove defaultValue

* use @flags-sdk/launchdarkly

* add install steps

* add changeset

* move @vercel/edge-config to peer deps

* add more secrets

* spell out name

* remove unused env var

* rename properties

* Capitalize

* Change import

* Fix more imports

* expose ldClient

* move peerDeps to real deps

* clarify Edge Config requirement in README

* remove adapter-launchdarkly snippet

* upgrade next@canary

* polish @flags-sdk/launchdarkly README

---------

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
2025-03-08 09:29:26 +02:00

97 lines
3.4 KiB
YAML

# This workflow lets you manually create snapshot relases
#
# A snapshot release is useful when you want to try out changes on a pull request
# before making a full release and without making a pre release mode.
#
# Problem
#
# This is useful as changesets force pre release mode across all packages in our
# mono repo. When using pre releases then stable releases of all packages are
# blocked until pre release is exited.
#
# What are snapshot releases
#
# To work around this issue we have this workflow. It lets you create a
# once-off release for a specific branch. We call those snapshot releases.
# Snapshot releases are published under the `snapshot` dist-tag and have
# versions like 0.4.0-579bd13f016c7de43a2830340634b3948db358b6-20230913164912,
# which consist of the version that would be generated, the commit hash and
# the timestamp.
#
# How to create a snapshot release
#
# Make sure you have a branch pushed to GitHub, and make sure that branch has
# a changeset committed. You can generate a changeset with "pnpm changeset".
#
# Then open github.com/vercel/variants and click on Actions > Release Snapshot
# Then click "Run workflow" on the right and select the branch you want to
# create a snapshot release for and click the "Run workflow" button.
#
# Then wait for the run to kick off and open the details.
# Find the "Create Snapshot Release" step in the logs.
# The last line of that log should contain something like
# 🦋 success packages published successfully:
# 🦋 @vercel/edge-config@0.4.0-579bd13f016c7de43a2830340634b3948db358b6-20230913164912
# This shows the version which was generated.
name: Release Snapshot
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
on:
workflow_dispatch:
jobs:
release-snapshot:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Add npm auth token to pnpm
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN_ELEVATED}"
env:
NPM_TOKEN_ELEVATED: ${{secrets.NPM_TOKEN_ELEVATED}}
- name: Install Dependencies
run: pnpm install
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${{ github.sha }} | cut -c1-8`" >> $GITHUB_ENV
- name: Version Packages
run: pnpm changeset version --snapshot ${SHORT_SHA}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
- name: Build
run: pnpm build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
EDGE_CONFIG: ${{ secrets.EDGE_CONFIG }}
FLAGS_SECRET: ${{ secrets.FLAGS_SECRET }}
FLAGS: ${{ secrets.FLAGS }}
HAPPYKIT_API_TOKEN: ${{ secrets.HAPPYKIT_API_TOKEN }}
HAPPYKIT_ENV_KEY: ${{ secrets.HAPPYKIT_ENV_KEY }}
LAUNCHDARKLY_CLIENT_SIDE_ID: ${{ secrets.LAUNCHDARKLY_CLIENT_SIDE_ID }}
LAUNCHDARKLY_PROJECT_SLUG: ${{ secrets.LAUNCHDARKLY_PROJECT_SLUG }}
- name: Publish Snapshot Release
run: pnpm changeset publish --no-git-tag --tag snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}