CI: deploy to gh-pages ()

This commit is contained in:
Matthew Ryan Dillon 2020-09-25 10:29:27 -07:00 committed by GitHub
parent 056471c0eb
commit 0377efebed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 5939 additions and 5 deletions

View file

@ -10,11 +10,33 @@ env:
CARGO_TERM_COLOR: always
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build
run: cargo build --verbose
- name: install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: check
run: cargo check
- name: test
run: cargo test --verbose
run: wasm-pack test --node
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: build
run: |
wasm-pack build
cd www
npm install
npm run build
- name: deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: www/dist

View file

@ -1,6 +1,6 @@
[package]
name = "gpx-web-utils"
version = "0.1.0"
version = "0.0.1"
authors = ["Matthew Dillon <matthewrdillon@gmail.com>"]
edition = "2018"

2
www/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules
dist

5
www/bootstrap.js vendored Normal file
View file

@ -0,0 +1,5 @@
// A dependency graph that contains any wasm must all be imported
// asynchronously. This `bootstrap.js` file does the single async import, so
// that no one else needs to worry about it again.
import("./index.js")
.catch(e => console.error("Error importing `index.js`:", e));

11
www/index.html Normal file
View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>gpx web utils</title>
</head>
<body>
<noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript>
<script src="./bootstrap.js"></script>
</body>
</html>

3
www/index.js Normal file
View file

@ -0,0 +1,3 @@
import * as wasm from "gpx-web-utils";
wasm.greet();

5842
www/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

35
www/package.json Normal file
View file

@ -0,0 +1,35 @@
{
"name": "gpx-web-utils",
"version": "0.0.1",
"description": "just some gpx-related tools that i want to use.",
"main": "index.js",
"scripts": {
"build": "webpack --config webpack.config.js",
"start": "webpack-dev-server"
},
"repository": {
"type": "git",
"url": "git+https://github.com/thermokarst/gpx-web-utils.git"
},
"keywords": [
"webassembly",
"wasm",
"rust",
"webpack"
],
"author": "Matthew Ryan Dillon <matthewrdillon@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/thermokarst/gpx-web-utils/issues"
},
"homepage": "https://github.com/thermokarst/gpx-web-util#readme",
"dependencies": {
"gpx-web-utils": "file:../pkg"
},
"devDependencies": {
"webpack": "^4.29.3",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5",
"copy-webpack-plugin": "^5.0.0"
}
}

14
www/webpack.config.js Normal file
View file

@ -0,0 +1,14 @@
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require('path');
module.exports = {
entry: "./bootstrap.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bootstrap.js",
},
mode: "development",
plugins: [
new CopyWebpackPlugin(['index.html'])
],
};