Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build and publish workflow #3

Merged
merged 26 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Publish
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [created]

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
# write is required to write to releases
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: '20.x'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Create Package
run: |
if npm version --no-git-tag-version from-git > /dev/null 2>&1; then
echo "Using auto version based on git tag"
else
echo "Using version 0.0.0-dev"
npm version --no-git-tag-version 0.0.0-dev
fi
mkdir out
npm pack --pack-destination out
- name: Upload build artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: package
path: out/
- name: Attach build artifact to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 2.0.8
with:
files: out/

2 changes: 2 additions & 0 deletions cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

import { render } from '@react-email/components';
import { Command } from 'commander';
import fs from 'fs';
Expand Down
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"name": "watcloud-emails",
"version": "0.0.1",
"bin": "./dist/cli/index.js",
"name": "@watonomous/watcloud-emails",
"bin": {
"watcloud-emails": "dist/cli/index.js"
},
"files": [
"dist"
],
"scripts": {
"dev": "concurrently --kill-others \"email dev\" \"tsc -w\"",
"build": "tsc",
"dev": "concurrently --kill-others \"email dev\" \"tsc -w\""
"prepack": "npm run build"
},
"dependencies": {
"@react-email/components": "0.0.25",
Expand Down