diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b49ff9c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: [20] + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: Install dependencies + run: pnpm install + + - name: Build + run: npm run build:shrunk-test && mv dist shrunk-test-dist && npm run build:shrunk-prod && mv dist shrunk-prod-dist + + - name: Archive Production Build + run: zip -r shrunk-test-dist.zip shrunk-test-dist/ && zip -r shrunk-prod-dist.zip shrunk-prod-dist/ + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + shrunk-test-dist.zip + shrunk-prod-dist.zip diff --git a/README.md b/README.md index 77da6ae..3c82fec 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,5 @@ Click [here](https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/sidelo ## Important Information Side-loading only works for Windows machines. + +`shrunk-dist-prod.zip` and `shrunk-dist-dev.zip` are distribution builds of this project that are built on every new tag creation (new release version. see `.github/workflows/ci.yml` for more details). They differ in their `manifest.xml` files: when grabbing assets, the base URL either becomes `go.rutgers.edu/outlook/assets` or `shrunk.rutgers.edu/outlook/assets`, where `shrunk.r.e` is the test instance of `go.rutgers.edu`. diff --git a/package.json b/package.json index a05856e..441345f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dev_server_port": 3000 }, "scripts": { - "build": "webpack --mode production", + "build:shrunk-test": "webpack --env urlProd=shrunk.rutgers.edu --mode production", + "build:shrunk-prod": "webpack --env urlProd=go.rutgers.edu --mode production", "build:dev": "webpack --mode development", "dev-server": "webpack serve --mode development", "lint": "office-addin-lint check", diff --git a/webpack.config.js b/webpack.config.js index 3312611..2f48f99 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,7 +5,6 @@ const CopyWebpackPlugin = require("copy-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const urlDev = "https://localhost:3000/"; -const urlProd = "https://www.contoso.com/"; // CHANGE THIS TO YOUR PRODUCTION DEPLOYMENT LOCATION async function getHttpsOptions() { const httpsOptions = await devCerts.getHttpsServerOptions(); @@ -14,6 +13,13 @@ async function getHttpsOptions() { module.exports = async (env, options) => { const dev = options.mode === "development"; + + if (!env.urlProd) { + throw new Error("urlProd is required"); + } + + const urlProd = env.urlProd; + const config = { devtool: "source-map", entry: {