Skip to content

Commit

Permalink
Fix deployment not working (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhouweling committed Nov 4, 2024
1 parent e2211bb commit 3c71ec1
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 29 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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' }}
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
branches:
- main

permissions:
checks: write
contents: write

jobs:
run-linters:
name: Run linters
Expand All @@ -36,17 +32,9 @@ jobs:
- name: Generate types
run: npm run build:generate-types

- name: Run format
run: npm run format

# TODO: remove once lint-action supports eslint v9
- name: Run eslint
run: npm run lint

- name: Run linters
uses: wearerequired/lint-action@v2
with:
auto_fix: true
# TODO: enable again once eslint v9 is supported
# eslint: true
# eslint_auto_fix: true
# eslint_args: "--max-warnings 0"
prettier: true
prettier_auto_fix: true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
17 changes: 9 additions & 8 deletions package-lock.json

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
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ main = "./src/server.mts"
compatibility_flags = [ "nodejs_compat" ]
compatibility_date = "2024-09-23"
upload_source_maps = true

[env.staging]
workers_dev = true

[env.production]
workers_dev = false

0 comments on commit 3c71ec1

Please sign in to comment.