Skip to content

Commit

Permalink
ci: added workflows to build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
TommasoAmici committed Jul 18, 2023
1 parent 1941a5d commit 3864233
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- run: bun install --ignore-scripts --no-progress
- run: bun test
- run: cd packages/tw-lite && bun typecheck
- run: cd packages/tw-lite && bun run build

- uses: actions/upload-artifact@v3
with:
name: artifacts
path: packages/tw-lite/dist

release:
name: Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- build
steps:
- uses: actions/checkout@v3
- name: Create changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-push: "false"
skip-version-file: "true"
output-file: "false"
skip-commit: "true"
skip-on-empty: "true"
skip-tag: "true"

- uses: actions/download-artifact@v3
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
name: artifacts
path: packages/tw-lite/dist

- name: Create Release
run: gh release create "$TAG_NAME" --notes "$BODY"
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ steps.changelog.outputs.tag }}
BODY: ${{ steps.changelog.outputs.clean_changelog }}

- uses: actions/setup-node@v3
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
node-version: 20

- run: npm publish
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion packages/tw-lite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"types": "dist/types.d.ts",
"scripts": {
"watch": "parcel watch",
"build": "parcel build"
"build": "parcel build",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@parcel/packager-ts": "2.9.3",
Expand Down

0 comments on commit 3864233

Please sign in to comment.