Skip to content

Commit

Permalink
build: auto deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanChanges committed Sep 1, 2024
1 parent abdbe16 commit c68c9a7
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 7 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
mkdir -p $RUNNER_TEMP/dist
cp -a * $RUNNER_TEMP/dist
cp -a .github $RUNNER_TEMP/dist
cp .* $RUNNER_TEMP/dist
mv $RUNNER_TEMP/dist dist

cd dist

# modify package.json
cat package.json | jq '.version="0.0.0" | del(.optionalDependencies)' > package.json.tmp
mv -f package.json.tmp package.json

sed -i .gitignore \
-e '/bun.lockb/d'

# modify workflows
cd .github/workflows

rm sync.yml
rm sync.sh
39 changes: 39 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Sync

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Check out
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Sync files
run: bash .github/workflows/sync.sh

- name: Deploy master
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.DEPLOY_KEY }}
publish_dir: dist
publish_branch: deploy
# https://github.com/peaceiris/actions-gh-pages/issues/163
exclude_assets: ''
force_orphan: true
commit_message: '[skip ci] deploy'

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Keys
deploy
deploy.pub

# Nuxt dev/build outputs
.output
.data
Expand Down
70 changes: 64 additions & 6 deletions .idea/workspace.xml

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nuxt-app",
"name": "cyan-home",
"private": true,
"type": "module",
"scripts": {
Expand Down

0 comments on commit c68c9a7

Please sign in to comment.