split ymls
This commit is contained in:
39
.github/workflows/generate.yml
vendored
39
.github/workflows/generate.yml
vendored
@@ -1,19 +1,17 @@
|
|||||||
name: Generate CRDs
|
name: Generate CRDs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 3 * * 1"
|
- cron: "0 3 * * 1"
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate-crds:
|
generate-crds:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
@@ -24,14 +22,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
|
|
||||||
- name: Install TypeScript
|
- name: Install TypeScript
|
||||||
run: npm install -g typescript
|
run: npm install -g typescript
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
|
|
||||||
- name: Fetch latest Gateway API release
|
- name: Fetch latest Gateway API release
|
||||||
run: |
|
run: |
|
||||||
GW_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/gateway-api/releases/latest | jq -r .tag_name)
|
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
|
- name: Run CRD generation script
|
||||||
run: node generate-crds.js
|
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: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
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"
|
# Bump patch version (e.g., 1.0.0 -> 1.0.1) without creating a git tag yet
|
||||||
git push
|
npm version patch --no-git-tag-version
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# Stage all changes including the new package.json
|
||||||
|
git add .
|
||||||
- name: Publish to npm (Trusted Publishing)
|
|
||||||
if: github.ref == 'refs/heads/main'
|
# Commit and Push
|
||||||
run: npm publish --provenance --access public
|
git commit -m "Update CRDs and bump version"
|
||||||
|
git push
|
||||||
35
.github/workflows/publisher.yml
vendored
Normal file
35
.github/workflows/publisher.yml
vendored
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user