diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..432cf5b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Deploy to GitHub pages +on: + push: + # this is the branch where you develop your site + # as discussed in the publishing sources section + # this can change if you are using an user/organization repo + branches: [main] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Generate static VuePress files + uses: actions/setup-node@v2 + with: + node-version: "18" + - run: npm i + - run: npm run build + + - name: Init new repo in dist folder and commit generated files + run: | + cd dist + git init + git add -A + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m 'deploy' + + - name: Force push to destination branch + uses: ad-m/github-push-action@v0.5.0 + with: + # Token for the repo + # Can be passed in using $\{{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + # Destination branch to push changes + branch: gh-pages + # Use force push to fully overwrite the destination branch + force: true + # We have to push from the folder where files were generated. + # Same were the new repo was initialized in the previous step + directory: ./dist diff --git a/package.json b/package.json index 3939fb2..22e256d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "scripts": { "dev": "webpack-cli serve --mode=development --env development --hot", - "build": "webpack --mode=production --env production --progress", + "build": "npm run build:wasm; webpack --mode=production --env production --progress", "build:wasm": "cd altr-wasm && wasm-pack build --target web --out-dir pkg", "lint": "eslint './src/**/*.{ts,tsx,js,jsx}'", "lint:fix": "eslint './src/**/*.{ts,tsx,js,jsx}' --fix" @@ -42,6 +42,7 @@ "ts-node": "10.9.1", "tsconfig-paths-webpack-plugin": "^4.1.0", "typescript": "4.9.5", + "wasm-pack": "^0.12.1", "webpack": "5.89.0", "webpack-cli": "4.10.0", "webpack-dev-server": "4.15.1"