Skip to content

Trigger build

Trigger build #74

Workflow file for this run

on:
push:
branches:
- main
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
outputs:
react-email: ${{ steps.filter.outputs.react-email }}
cli: ${{ steps.filter.outputs.cli }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: 🔍 Run type checking
run: bun run typecheck
# - name: 🚨 Run linting
# run: bun run lint
- name: 🧪 Run unit tests
run: bun run test
- name: Filter changes
id: filter
uses: dorny/paths-filter@v2
with:
filters: |
react-email:
- 'packages/react-email/src/**'
cli:
- 'packages/cli/src/**'
publish-cli:
name: Publish CLI
if: needs.test.outputs.cli == 'true'
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build
working-directory: packages/cli
run: bun run build
- name: Get version
id: get_version
working-directory: packages/cli
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
echo "new_version=$(npx semver ${CURRENT_VERSION} -i patch)" >> $GITHUB_OUTPUT
- name: Update version
working-directory: packages/cli
run: npm version ${{ steps.get_version.outputs.new_version }} --no-git-tag-version
- name: Commit package.json changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull origin main
git add packages/cli/package.json
git commit -m "chore: bump languine to v${{ steps.get_version.outputs.new_version }}"
git push
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get_version.outputs.new_version }}
name: Release (languine) v${{ steps.get_version.outputs.new_version }}
generate_release_notes: true
- name: Setup NPM Auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish to NPM
working-directory: packages/cli
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-react-email:
name: Publish React Email
if: needs.test.outputs.react-email == 'true'
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build
working-directory: packages/react-email
run: bun run build
- name: Get version
id: get_version
working-directory: packages/react-email
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
echo "new_version=$(npx semver ${CURRENT_VERSION} -i patch)" >> $GITHUB_OUTPUT
- name: Update version
working-directory: packages/react-email
run: npm version ${{ steps.get_version.outputs.new_version }} --no-git-tag-version
- name: Commit package.json changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull origin main
git add packages/react-email/package.json
git commit -m "chore: bump @languine/react-email to v${{ steps.get_version.outputs.new_version }}"
git push
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get_version.outputs.new_version }}
name: Release (@languine/react-email) v${{ steps.get_version.outputs.new_version }}
generate_release_notes: true
- name: Setup NPM Auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish to NPM
working-directory: packages/react-email
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}