-
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (73 loc) · 2.3 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: MC CD
on:
workflow_run:
workflows: ["MC CI"]
branches: [main]
types:
- completed
jobs:
deploy:
name: Deploy to Zaraz via Worker
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies for mc
working-directory: ./mc
run: npm ci
- name: Build
working-directory: ./mc
run: npm run build
- name: Create Worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: yes | npx managed-component-to-cloudflare-worker ./mc/dist/index.js custom-mc-counterscale ./wrangler.toml
release:
name: Release to GitHub Releases
runs-on: ubuntu-latest
timeout-minutes: 10
needs: deploy
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'mackenly' && github.ref == 'refs/heads/main' }}
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm ci
working-directory: ./mc
- name: Build
run: npm run build
working-directory: ./mc
- name: Bump version and tag commit
id: versioning
uses: phips28/gh-action-bump-version@master
with:
tag-prefix: 'v'
patch-wording: 'bump-patch,fixes,Fixes,bugfix,Bugfix,patch,hotfix,Hotfix'
minor-wording: 'bump-minor,adds,Adds,new'
major-wording: 'bump-major,MAJOR' # ,removes,Removes,delete,Delete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: 'mc'
- name: Create Release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.versioning.outputs.newTag }}
name: ${{ steps.versioning.outputs.newTag }}
generateReleaseNotes: true
draft: false
prerelease: false