fix: readme links (#323) #264
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: 'Release' | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Publish | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- name: posthog-react-native | |
npm_token_secret: NPM_TOKEN_BEN_WHITE # TODO: Change to standard token once able | |
- name: posthog-node | |
npm_token_secret: NPM_TOKEN_BEN_WHITE # TODO: Change to standard token once able | |
- name: posthog-web | |
npm_token_secret: NPM_TOKEN # TODO: Change to standard token once able | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Check package version and detect an update | |
id: check-package-version | |
uses: PostHog/check-package-version@v2 | |
with: | |
path: ${{ matrix.package.name }} | |
- name: Set up Node 18 | |
uses: actions/setup-node@v4 | |
if: steps.check-package-version.outputs.is-new-version == 'true' | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
if: steps.check-package-version.outputs.is-new-version == 'true' | |
run: yarn --frozen-lockfile | |
- name: Build | |
if: steps.check-package-version.outputs.is-new-version == 'true' | |
run: yarn build | |
- name: Publish the package in the npm registry | |
id: publish-package | |
if: steps.check-package-version.outputs.is-new-version == 'true' | |
working-directory: ${{ matrix.package.name }} | |
run: | | |
tag="alpha" | |
echo ::set-output name=tag::alpha | |
if [[ $VERSION =~ ^[0-9]+(\.[0-9]+){2,3}$ ]]; then | |
echo ::set-output name=tag::latest | |
tag="latest" | |
fi | |
npm publish --access public --tag $tag | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets[matrix.package.npm_token_secret] }} | |
VERSION: ${{ steps.check-package-version.outputs.committed-version }} | |
- name: Create GitHub release | |
if: steps.check-package-version.outputs.is-new-version == 'true' && steps.publish-package.outputs.tag == 'latest' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ matrix.package.name }}-v${{ steps.check-package-version.outputs.committed-version }} | |
release_name: ${{ matrix.package.name }}-${{ steps.check-package-version.outputs.committed-version }} |