Skip to content

Commit

Permalink
Prep release (#86)
Browse files Browse the repository at this point in the history
- Add husky hooks for pre-commit
  - Add staged-lint for pre-commit to check staged files

- Edit workflows
  - Adjust use of Bun 
- Configure workflow actions, testing release with a dry-run, ensure
build actions work
  • Loading branch information
itsacoyote authored May 24, 2024
1 parent e742ea5 commit a3976c8
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install
run: bun install --production --frozen-lockfile

- name: "Deploy target: staging"
run: bun run build
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ jobs:
steps:
- uses: actions/checkout@v4 # v4
with:
fetch-depth: 0
# Whether to configure the token or SSH key with the local git config
# Default: true
persist-credentials: false # <--- checking this in commit context

- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install
run: bun install --production --frozen-lockfile
- name: "Deploy target: staging"
run: bun run build

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install
run: bun install --production --frozen-lockfile
- name: "Deploy target: staging"
run: bun run build

Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: "release 🚀"
"on":
name: release 🚀

on:
push:
branches: [ main ]

env:
HUSKY: 0
CI: true

jobs:
release:
if: ${{ github.event.repository.full_name == github.repository }} && {{ !contains(github.event.head_commit.message, "skip ci") }}
Expand All @@ -12,14 +18,15 @@ jobs:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version: 'latest'
- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install
run: bun install --frozen-lockfile

- name: "Semantic release"
run: bun run semantic-release
- name: "Release"
run: bun run release
env:
HUSKY: 0
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0);
}
const husky = (await import('husky')).default;
console.log(husky());
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
bun lint-staged
8 changes: 8 additions & 0 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'*.{js,ts,vue}':
- prettier --list-different
- eslint
'*.md':
- cspell
- markdownlint-cli2
'*.{json,yml}':
- prettier --list-different
Binary file modified bun.lockb
Binary file not shown.
8 changes: 2 additions & 6 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
"*.css",
"*.config.*",
"node_modules/**",
".github/**",
".firebase/**",
".yarn/**",
".*/**",
"dist/**",
".vscode/**",
"cspell-config/**",
"package.json",
".**.**"
"package.json"
],
"caseSensitive": true,
"dictionaries": [
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"cspell": "^8.6.0",
"eslint": "^8.52.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.4",
"markdownlint": "^0.33.0",
"markdownlint-cli2": "^0.12.1",
"nuxt-headlessui": "^1.2.0",
"particles.vue3": "^2.12.0",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.12",
Expand All @@ -36,6 +36,7 @@
"@nuxt/image": "^1.6.0",
"@nuxt/ui-pro": "^1.0.2",
"@nuxtjs/seo": "^2.0.0-rc.10",
"nuxt-headlessui": "^1.2.0",
"@tsparticles/slim": "^3.3.0",
"@tsparticles/vue3": "^3.0.1",
"nuxt": "^3.11.2",
Expand All @@ -54,9 +55,9 @@
"lint:eslint": "eslint .",
"lint:prettier": "prettier --check .",
"fix:prettier": "prettier --write .",
"prepare": "husky",
"prepare": "node .husky/install.mjs",
"postinstall": "nuxt prepare",
"ci:check": "bun run lint:eslint && bun run lint:prettier && bun run lint:spelling && bun run lint:markdown",
"semantic-release": "semantic-release"
"release": "semantic-release"
}
}

0 comments on commit a3976c8

Please sign in to comment.