Updating #14
Workflow file for this run
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: TypeScript SDK CI | |
permissions: | |
contents: 'write' | |
on: | |
push: | |
tags: | |
- 'v*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
working-directory: typescript | |
env: | |
CI: true | |
# Enable debug logging for actions | |
ACTIONS_RUNNER_DEBUG: true | |
jobs: | |
Publish: | |
# run only on 'main' branch | |
if: github.ref == 'refs/heads/main' | |
strategy: | |
matrix: | |
node_version: ['lts/*'] | |
os: ['ubuntu-latest'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
cache: 'yarn' | |
cache-dependency-path: 'typescript/yarn.lock' | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Bundle & Build | |
run: yarn build | |
- name: Publish to npm Registry | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: yarn publish --access public --registry https://registry.npmjs.org | |
- name: Add Token to .npmrc & Update package.json | |
working-directory: typescript | |
run: | | |
# | |
# Add token to .npmrc | |
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc | |
# | |
# Update 'github-package-registry' to 'registry' in package.json | |
sed -i 's/github-package-registry/registry/g' package.json | |
- name: Publish to GitHub Package Registry | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: yarn publish --access public --registry https://npm.pkg.github.com | |
# Generate GitHub Release Changelog | |
Changelog: | |
# make sure we're on 'main' branch | |
if: github.ref == 'refs/heads/main' | |
needs: [Publish] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Generate Changelog | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx changelogithub |