workflow-release #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: Export DSL reference | |
| run: wfctl dsl-reference > src/generated/dsl-reference.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 ls-remote --tags origin "refs/tags/${WORKFLOW_VERSION}" | grep -q .; then | |
| echo "Tag ${WORKFLOW_VERSION} already exists on remote, 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 }}"}' |