-
-
Notifications
You must be signed in to change notification settings - Fork 327
165 lines (141 loc) · 4.6 KB
/
Copy pathpublish.yml
File metadata and controls
165 lines (141 loc) · 4.6 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: publish
run-name: "${{ format('release {0}', inputs.bump) }}"
on:
workflow_dispatch:
inputs:
bump:
description: "Bump major, minor, patch, beta, or canary"
required: false
type: choice
options:
- major
- minor
- patch
- beta
- canary
version:
description: "Override version (optional)"
required: false
type: string
platform:
description: "Build only this OS (all = every platform)"
required: false
type: choice
default: all
options:
- all
- windows
- linux
- darwin
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.version || inputs.bump }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
jobs:
version:
runs-on: ubuntu-24.04
if: github.repository == 'CyberStrikeus/CyberStrike'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup-bun
- name: Install CyberStrike
if: inputs.bump || inputs.version
continue-on-error: true
run: bun i -g @cyberstrike-io/cyberstrike
- id: version
run: |
./script/version.ts
env:
GH_TOKEN: ${{ github.token }}
CYBERSTRIKE_BUMP: ${{ inputs.bump }}
CYBERSTRIKE_VERSION: ${{ inputs.version }}
CYBERSTRIKE_API_KEY: ${{ secrets.CYBERSTRIKE_API_KEY }}
outputs:
version: ${{ steps.version.outputs.version }}
release: ${{ steps.version.outputs.release }}
tag: ${{ steps.version.outputs.tag }}
build-app:
needs: version
runs-on: ubuntu-24.04
if: github.repository == 'CyberStrikeus/CyberStrike'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-bun
- name: Build Web UI
run: bun install && bun turbo build --filter=@cyberstrike-io/app
env:
CYBERSTRIKE_VERSION: ${{ needs.version.outputs.version }}
- uses: actions/upload-artifact@v4
with:
name: cyberstrike-web
path: packages/app/dist
build-cli:
needs: version
runs-on: ubuntu-24.04
if: github.repository == 'CyberStrikeus/CyberStrike'
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
- uses: ./.github/actions/setup-bun
- name: Build
id: build
run: |
./packages/cyberstrike/script/build.ts
env:
CYBERSTRIKE_VERSION: ${{ needs.version.outputs.version }}
CYBERSTRIKE_RELEASE: ${{ needs.version.outputs.release }}
CYBERSTRIKE_BUILD_OS: ${{ inputs.platform }}
GH_TOKEN: ${{ github.token }}
- uses: actions/upload-artifact@v4
with:
name: cyberstrike-cli
path: packages/cyberstrike/dist
outputs:
version: ${{ needs.version.outputs.version }}
publish:
needs:
- version
- build-cli
- build-app
if: ${{ !cancelled() && needs.build-cli.result == 'success' && needs.build-app.result == 'success' }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-bun
- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Setup git committer
id: committer
continue-on-error: true
uses: ./.github/actions/setup-git-committer
with:
cyberstrike-app-id: ${{ vars.CYBERSTRIKE_APP_ID }}
cyberstrike-app-secret: ${{ secrets.CYBERSTRIKE_APP_SECRET }}
- name: Fallback git config
if: steps.committer.outcome == 'failure'
run: |
git config --global user.name "cyberstrike[bot]"
git config --global user.email "cyberstrike[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${{ secrets.PUBLISH_TOKEN }}@github.com/${{ github.repository }}"
- uses: actions/download-artifact@v4
with:
name: cyberstrike-cli
path: packages/cyberstrike/dist
- uses: actions/download-artifact@v4
with:
name: cyberstrike-web
path: packages/app/dist
- run: ./script/publish.ts
env:
CYBERSTRIKE_VERSION: ${{ needs.version.outputs.version }}
CYBERSTRIKE_RELEASE: ${{ needs.version.outputs.release }}
GITHUB_TOKEN: ${{ steps.committer.outputs.token || secrets.PUBLISH_TOKEN || github.token }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: false