feat(js-sdk,py-sdk): Rename rootDir/rootdir to cwd, add cwd option to… #172
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 | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
permissions: | |
contents: write | |
jobs: | |
is_release: | |
name: Is release? | |
runs-on: ubuntu-latest | |
outputs: | |
release: ${{ steps.version.outputs.release }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
- name: Setup Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: pnpm | |
- name: Install npm dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Check if new version | |
id: version | |
run: | | |
IS_RELEASE=$(./.github/scripts/is_release.sh) | |
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT" | |
release: | |
needs: [ is_release ] | |
if: 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.11" | |
- 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@v2 | |
- name: Setup Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
id: cache-modules | |
with: | |
path: node_modules | |
key: node_modules-${{hashFiles('package-lock.json')}} | |
restore-keys: node_modules- | |
- name: Run tests | |
run: pnpm run test | |
env: | |
E2B_API_KEY: ${{ secrets.E2B_API_KEY }} | |
- 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 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
- name: Commit new versions | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -am "[skip ci] Release new versions" || exit 0 | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release Failed - Slack Notification | |
if: failure() | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_COLOR: '#ff0000' | |
SLACK_MESSAGE: ':here-we-go-again: :bob-the-destroyer: We need :fix-parrot: ASAP :pray:' | |
SLACK_TITLE: Release Failed | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |