-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (82 loc) · 3.05 KB
/
sync-schema.yml
File metadata and controls
94 lines (82 loc) · 3.05 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
name: Sync Schema on Workflow Release
on:
repository_dispatch:
types: [workflow-release]
permissions:
contents: write
packages: write
jobs:
sync:
name: Update types, publish, and notify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://npm.pkg.github.com'
scope: '@gocodealone'
- name: Install wfctl
run: |
WORKFLOW_VERSION="${{ github.event.client_payload.version }}"
curl -fsSL "https://github.com/GoCodeAlone/workflow/releases/download/${WORKFLOW_VERSION}/wfctl-linux-amd64" -o /usr/local/bin/wfctl
chmod +x /usr/local/bin/wfctl
- name: Regenerate type catalogue
run: wfctl schema --output schemas/workflow-config.schema.json
- name: Export editor schemas
run: wfctl editor-schemas --output src/generated/engine-schemas.json
- name: Bump version
run: |
WORKFLOW_VERSION="${{ github.event.client_payload.version }}"
EDITOR_VERSION="${WORKFLOW_VERSION#v}"
CURRENT=$(node -p "require('./package.json').version")
if [ "$CURRENT" = "$EDITOR_VERSION" ]; then
echo "Already at ${EDITOR_VERSION}, skipping"
else
npm version "${EDITOR_VERSION}" --no-git-tag-version
fi
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npx tsc --noEmit
- run: npm test
- run: npm run build
- name: Publish to GitHub Packages
run: npm publish || echo "Publish failed (version may already exist)"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit and tag
run: |
WORKFLOW_VERSION="${{ github.event.client_payload.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --cached --quiet && echo "No changes" && exit 0
git commit -m "chore: sync types to workflow ${WORKFLOW_VERSION}"
git pull --rebase origin master
git push
if git rev-parse "${WORKFLOW_VERSION}" >/dev/null 2>&1; then
echo "Tag ${WORKFLOW_VERSION} already exists, skipping"
else
git tag "${WORKFLOW_VERSION}"
git push origin "${WORKFLOW_VERSION}"
fi
notify-consumers:
name: Notify IDE Plugins
runs-on: ubuntu-latest
needs: sync
strategy:
matrix:
repo:
- 'GoCodeAlone/workflow-vscode'
- 'GoCodeAlone/workflow-jetbrains'
steps:
- name: Dispatch editor-release to ${{ matrix.repo }}
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
repository: ${{ matrix.repo }}
event-type: editor-release
client-payload: '{"version": "${{ github.event.client_payload.version }}"}'