Skip to content

Commit a70ed7e

Browse files
authored
Merge pull request #3 from the-hideout/ci-deploy
add pull_request
2 parents 60a7349 + 16e89b8 commit a70ed7e

File tree

3 files changed

+63
-9
lines changed

3 files changed

+63
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy
1+
name: deploy
22

33
on:
44
push:
@@ -10,17 +10,26 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
1413
- name: Checkout
15-
uses: actions/checkout@v2
14+
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # pin@v2
1615

1716
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # pin@v1
1918
with:
2019
node-version: ${{ matrix.node-version }}
2120

22-
- name: Publish
23-
uses: cloudflare/wrangler-action@1.3.0
21+
- name: Publish - Production
22+
uses: cloudflare/wrangler-action@3424d15af26edad39d5276be3cc0cc9ffec22b55 # pin@1.3.0
2423
with:
2524
apiToken: ${{ secrets.CF_API_TOKEN }}
26-
# environment: 'production'
25+
environment: "production"
26+
27+
# Send a deployment message to Discord via a webhook
28+
- name: Discord notification
29+
if: github.event_name == 'push'
30+
env:
31+
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_URL }}
32+
uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9 # pin@0.3.2
33+
with:
34+
args: "The project `{{ EVENT_PAYLOAD.repository.full_name }}` has been
35+
**deployed** to **production** 🚀"

.github/workflows/pull_request.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: pull_request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # pin@v2
14+
15+
- name: Use Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # pin@v1
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
20+
- name: Publish - Development
21+
uses: cloudflare/wrangler-action@3424d15af26edad39d5276be3cc0cc9ffec22b55 # pin@1.3.0
22+
with:
23+
apiToken: ${{ secrets.CF_API_TOKEN }}
24+
environment: "development"
25+
26+
# Post comment on PR with development deploy info
27+
- uses: actions/github-script@5d03ada4b0a753e9460b312e61cc4f8fdeacf163 # pin@0.9.0
28+
with:
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
script: |
31+
const output = `### API Deployment - Development 🪐
32+
33+
The API has been **deployed** to the **development** environment 🚀
34+
35+
- Endpoint: \`dev-api.thehideout.io\`
36+
- Playground: [dev-api.thehideout.io/___graphql](https://dev-api.thehideout.io/___graphql)
37+
38+
> Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\``;
39+
40+
github.issues.createComment({
41+
issue_number: context.issue.number,
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
body: output
45+
})

wrangler.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ kv-namespaces = [
1111
]
1212

1313
[env.development]
14-
#routes = ["tarkov-tools.com/graphql", "tarkov-tools.com/graphql*", "tarkov-tools.com/___graphql", "tarkov-tools.com/webhook*", "tutorial.cloudflareworkers.com/graphql","tutorial.cloudflareworkers.com/graphql*", "tutorial.cloudflareworkers.com/___graphql", "localhost:8787/graphql","localhost:8787/graphql*", "localhost:8787/___graphql"]
15-
#kv-namespaces = []
14+
routes = ["dev.api.thehideout.io/graphql", "dev.api.thehideout.io/graphql*", "dev.api.thehideout.io/___graphql", "dev.api.thehideout.io/webhook*"]
15+
kv-namespaces = []

0 commit comments

Comments
 (0)