Skip to content

Commit

Permalink
Merge pull request #3 from filecoin-station/fix-deployment
Browse files Browse the repository at this point in the history
Fix deployment
  • Loading branch information
pyropy authored Dec 17, 2024
2 parents d0c17ef + e3fcee0 commit 1835c06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- run: cp wrangler.toml.example wrangler.toml
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- run: npm ci
- run: npm test

Expand All @@ -27,6 +27,7 @@ jobs:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
preCommands: |
cp wrangler.toml.example wrangler.toml
envsubst < wrangler.toml.example > wrangler.toml
Expand All @@ -36,7 +37,7 @@ jobs:
secrets: |
INFLUX_TOKEN
env:
INFLUX_METRIC_NAME: ${{ env.INFLUX_METRIC }}
INFLUX_URL: ${{ env.INFLUX_URL }}
INFLUX_METRIC_NAME: ${{ vars.INFLUX_METRIC_NAME }}
INFLUX_URL: ${{ vars.INFLUX_URL }}
INFLUX_TOKEN: ${{ secrets.INFLUX_TOKEN }}
INFLUX_DATABASE: ${{ env.INFLUX_DATABASE }}
INFLUX_DATABASE: ${{ vars.INFLUX_DATABASE }}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cp wrangler.toml.example wrangler.toml
npm run dev
```

## Deployment to production
## Deployment (Github Actions)

In order to deploy your worker via Github Actions, you need to have a [Cloudflare API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) and running instance of InfluxDB.

Expand All @@ -34,4 +34,6 @@ Add generated API token to Github secrets as `CLOUDFLARE_API_TOKEN` and authenti
Other required environment variables include the following:
- `INFLUX_URL` - InfluxDB URL
- `INFLUX_DATABASE` - InfluxDB database (bucket) name
- `INFLUX_METRIC_NAME` - InfluxDB metric name
- `INFLUX_METRIC_NAME` - InfluxDB metric name

After setting up secrets, you can push your code to Github and worker will be deployed to production environment automatically.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"description": "A template for kick starting a Cloudflare Workers project",
"main": "index.js",
"scripts": {
"deploy": "wrangler deploy",
"deploy:prod": "wrangler deploy --env production",
"deploy": "wrangler deploy --env production",
"deploy:dev": "wrangler deploy --env dev",
"dev": "wrangler dev --env dev",
"start": "wrangler dev",
"test": "vitest run",
Expand Down

0 comments on commit 1835c06

Please sign in to comment.