From 32e2cfc87c040c5a6c5c8023712e5f9dfe033a03 Mon Sep 17 00:00:00 2001 From: David Houweling Date: Mon, 4 Nov 2024 11:44:10 +1100 Subject: [PATCH] Fix deployment not working (#16) --- .github/workflows/deploy.yml | 32 ++++++++++++++++++++++++++++++-- README.md | 6 +++--- b38b0d0 | 1 + package-lock.json | 17 +++++++++-------- package.json | 2 +- 5 files changed, 44 insertions(+), 14 deletions(-) create mode 160000 b38b0d0 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5717c00..a9b711e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,16 +1,31 @@ -name: Deply +name: Deploy on: workflow_run: workflows: [Build] - types: [completed] + types: + - completed jobs: deploy: runs-on: ubuntu-latest + environment: + name: ${{ github.event.pull_request.base.ref == 'main' && 'production' || 'staging' }} if: ${{ github.event.workflow_run.conclusion == 'success' }} timeout-minutes: 60 steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + + - name: Install Node.js dependencies + run: npm ci + - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -24,6 +39,19 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + vars: | + DISCORD_APP_ID + DISCORD_PUBLIC_KEY + XBOX_USERNAME + secrets: | + DISCORD_TOKEN + XBOX_PASSWORD + env: + DISCORD_APP_ID: ${{ vars.DISCORD_APP_ID }} + DISCORD_PUBLIC_KEY: ${{ vars.DISCORD_PUBLIC_KEY }} + DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} + XBOX_USERNAME: ${{ vars.XBOX_USERNAME }} + XBOX_PASSWORD: ${{ secrets.XBOX_PASSWORD }} deploy-cancel: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }} diff --git a/README.md b/README.md index 6b6c882..fae1e20 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ This Discord bot can pull stats from Halo Waypoint and post accordingly. 1. [Download and install node.js](https://nodejs.org/en/download/package-manager) if you haven't done already 2. Clone the repo (assuming you already know how) 3. Follow the instructions from [`discord/cloudflare-sample-app`](https://github.com/discord/cloudflare-sample-app) - a. [Configuring project](https://github.com/discord/cloudflare-sample-app?tab=readme-ov-file#configuring-project) - b. [Creating your Cloudflare worker](https://github.com/discord/cloudflare-sample-app?tab=readme-ov-file#creating-your-cloudflare-worker) - c. [Running locally](https://github.com/discord/cloudflare-sample-app?tab=readme-ov-file#running-locally) + 1. [Configuring project](https://github.com/discord/cloudflare-sample-app?tab=readme-ov-file#configuring-project) + 2. [Creating your Cloudflare worker](https://github.com/discord/cloudflare-sample-app?tab=readme-ov-file#creating-your-cloudflare-worker) + 3. [Running locally](https://github.com/discord/cloudflare-sample-app?tab=readme-ov-file#running-locally) Now in a channel you can use `/stats` command. diff --git a/b38b0d0 b/b38b0d0 new file mode 160000 index 0000000..b38b0d0 --- /dev/null +++ b/b38b0d0 @@ -0,0 +1 @@ +Subproject commit b38b0d04d8308aebf5a7fdf2fa9c9ae28e5ee29c diff --git a/package-lock.json b/package-lock.json index 056da87..7e246ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "guilty-spark", "version": "1.0.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "@xboxreplay/xboxlive-auth": "^4.0.0", @@ -30,7 +31,7 @@ "tsx": "^4.19.2", "typescript": "^5.6.3", "typescript-eslint": "^8.10.0", - "wrangler": "^3.83.0" + "wrangler": "^3.84.1" } }, "node_modules/@azure/msal-common": { @@ -4186,9 +4187,9 @@ }, "node_modules/unenv": { "name": "unenv-nightly", - "version": "2.0.0-20241018-011344-e666fcf", - "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241018-011344-e666fcf.tgz", - "integrity": "sha512-D00bYn8rzkCBOlLx+k1iHQlc69jvtJRT7Eek4yIGQ6461a2tUBjngGZdRpqsoXAJCz/qBW0NgPting7Zvg+ysg==", + "version": "2.0.0-20241024-111401-d4156ac", + "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241024-111401-d4156ac.tgz", + "integrity": "sha512-xJO1hfY+Te+/XnfCYrCbFbRcgu6XEODND1s5wnVbaBCkuQX7JXF7fHEXPrukFE2j8EOH848P8QN19VO47XN8hw==", "dev": true, "license": "MIT", "dependencies": { @@ -4275,9 +4276,9 @@ } }, "node_modules/wrangler": { - "version": "3.83.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.83.0.tgz", - "integrity": "sha512-qDzdUuTngKqmm2OJUZm7Gk4+Hv37F2nNNAHuhIgItEIhxBdOVDsgKmvpd+f41MFxyuGg3fbGWYANHI+0V2Z5yw==", + "version": "3.84.1", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.84.1.tgz", + "integrity": "sha512-w27/QpIk2qz6aMIVi9T8cDcXMvh/RXjcL+vf4o5J2GpQAE4U7wTCNHyaY9H3oTJWRN97KqCAEbiHBNtTKoUJEw==", "dev": true, "license": "MIT OR Apache-2.0", "dependencies": { @@ -4297,7 +4298,7 @@ "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", "source-map": "^0.6.1", - "unenv": "npm:unenv-nightly@2.0.0-20241018-011344-e666fcf", + "unenv": "npm:unenv-nightly@2.0.0-20241024-111401-d4156ac", "workerd": "1.20241022.0", "xxhash-wasm": "^1.0.1" }, diff --git a/package.json b/package.json index 4781879..45aac46 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "tsx": "^4.19.2", "typescript": "^5.6.3", "typescript-eslint": "^8.10.0", - "wrangler": "^3.83.0" + "wrangler": "^3.84.1" }, "overrides": { "@types/node": "20.8.3"