Skip to content

Commit

Permalink
Move publishing to separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubno committed Oct 22, 2024
1 parent ee4f850 commit f185b31
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 67 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/publish_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Test JS SDK

on:
workflow_call:
secrets:
E2B_API_KEY:
required: true
GITHUB_TOKEN:
required: true
NPM_TOKEN:
required: true
PYPI_TOKEN:
required: true

permissions:
contents: read

jobs:
test:
defaults:
run:
working-directory: ./packages/js-sdk
name: Build and test SDK
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- uses: pnpm/action-setup@v3
with:
version: 9.5

- name: Setup Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: pnpm

- name: Configure pnpm
run: |
pnpm config set auto-install-peers true
pnpm config set exclude-links-from-lockfile true
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create new versions
run: pnpm run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release new versions
uses: changesets/action@v1
with:
publish: pnpm run publish
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

- name: Generate API Ref
run: pnpm run generate-api-reference

- name: Update lock file
run: pnpm i --no-link --no-frozen-lockfile

- name: Commit new versions
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add apps/web/src/app/\(docs\)/docs/api-reference
git commit -am "[skip ci] Release new versions" || exit 0
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -111,75 +111,11 @@ jobs:
secrets: inherit

release:
name: Release
needs: [is_release, python-tests, js-tests, cli-tests]
if: !contains(needs.*.result, 'failure') && !cancelled() && needs.is_release.outputs.release == 'true'
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- uses: pnpm/action-setup@v3
with:
version: 9.5

- name: Setup Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: pnpm

- name: Configure pnpm
run: |
pnpm config set auto-install-peers true
pnpm config set exclude-links-from-lockfile true
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create new versions
run: pnpm run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release new versions
uses: changesets/action@v1
with:
publish: pnpm run publish
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

- name: Generate API Ref
run: pnpm run generate-api-reference

- name: Update lock file
run: pnpm i --no-link --no-frozen-lockfile

- name: Commit new versions
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add apps/web/src/app/\(docs\)/docs/api-reference
git commit -am "[skip ci] Release new versions" || exit 0
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/workflows/publish_packages.yml
secrets: inherit

report-failure:
needs: [python-tests, js-tests, cli-tests, release]
Expand Down

0 comments on commit f185b31

Please sign in to comment.