From 8485e7001e86bc2da0d1496ad261f728c9e54ed4 Mon Sep 17 00:00:00 2001 From: GigiaJ Date: Mon, 24 Nov 2025 01:32:00 -0600 Subject: [PATCH] split ymls --- .github/workflows/generate.yml | 39 ++++++++++++++++++--------------- .github/workflows/publisher.yml | 35 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/publisher.yml diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 4694b76..97166a8 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -1,19 +1,17 @@ name: Generate CRDs on: - workflow_dispatch: + workflow_dispatch: schedule: - - cron: "0 3 * * 1" + - cron: "0 3 * * 1" push: branches: [ main ] -permissions: - contents: write - id-token: write - jobs: generate-crds: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout repo @@ -24,14 +22,12 @@ jobs: with: node-version: '20' - - name: Install TypeScript run: npm install -g typescript - name: Install dependencies run: npm install - - name: Fetch latest Gateway API release run: | GW_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/gateway-api/releases/latest | jq -r .tag_name) @@ -54,16 +50,23 @@ jobs: - name: Run CRD generation script run: node generate-crds.js - - name: Commit changes + - name: Check for changes + id: git-check + run: | + git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT + + - name: Bump Version and Push + if: steps.git-check.outputs.changes == 'true' run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - git add generated/crds .crd2pulumi-checksum - git commit -m "Update CRDs" || echo "No changes to commit" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to npm (Trusted Publishing) - if: github.ref == 'refs/heads/main' - run: npm publish --provenance --access public + + # Bump patch version (e.g., 1.0.0 -> 1.0.1) without creating a git tag yet + npm version patch --no-git-tag-version + + # Stage all changes including the new package.json + git add . + + # Commit and Push + git commit -m "Update CRDs and bump version" + git push \ No newline at end of file diff --git a/.github/workflows/publisher.yml b/.github/workflows/publisher.yml new file mode 100644 index 0000000..84b3499 --- /dev/null +++ b/.github/workflows/publisher.yml @@ -0,0 +1,35 @@ +name: Publish to NPM + +on: + workflow_run: + workflows: ["Generate CRDs"] + types: + - completed + +jobs: + publish: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Publish to npm (Trusted Publishing) + run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Sometimes required by setup-node, but OIDC does the heavy lifting \ No newline at end of file