Skip to content

Commit f3ce939

Browse files
CopilotEMaher
andauthored
feat: hook up integration test workflow before npm publish
- Add workflow_call trigger to integration-test.yml so it can be reused as a called workflow - Create publish.yml workflow that gates npm publish on the all-resource-types round-trip integration test passing first Closes #25 Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/2d7b027b-8e3f-43e5-828d-fdca8fd0fc7a Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
1 parent 7971b18 commit f3ce939

2 files changed

Lines changed: 111 additions & 0 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@ on:
3535
type: boolean
3636
default: false
3737

38+
workflow_call:
39+
inputs:
40+
sku:
41+
description: 'APIM SKU'
42+
required: false
43+
type: string
44+
default: StandardV2
45+
location:
46+
description: 'Azure region'
47+
required: false
48+
type: string
49+
default: 'eastus2'
50+
skip_teardown:
51+
description: 'Skip teardown (for debugging)'
52+
required: false
53+
type: boolean
54+
default: false
55+
secrets:
56+
AZURE_CLIENT_ID:
57+
required: true
58+
AZURE_TENANT_ID:
59+
required: true
60+
AZURE_SUBSCRIPTION_ID:
61+
required: true
62+
APIM_PUBLISHER_EMAIL:
63+
required: true
64+
3865
permissions:
3966
id-token: write
4067
contents: read

.github/workflows/publish.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# ===========================================================================
2+
# Publish to npm — Gated by Integration Test
3+
# ===========================================================================
4+
# Manually triggered workflow that runs the all-resource-types round-trip
5+
# integration test before publishing a new package version to npm.
6+
#
7+
# Required secrets (in the 'integration-test' environment):
8+
# - AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID (OIDC login)
9+
# - APIM_PUBLISHER_EMAIL
10+
#
11+
# Required secrets (in the 'npm-publish' environment):
12+
# - NPM_TOKEN
13+
# ===========================================================================
14+
15+
name: Publish to npm
16+
17+
on:
18+
workflow_dispatch:
19+
inputs:
20+
sku:
21+
description: 'APIM SKU for integration test'
22+
required: true
23+
type: choice
24+
options:
25+
- StandardV2
26+
- Developer
27+
- Premium
28+
- PremiumV2
29+
default: StandardV2
30+
location:
31+
description: 'Azure region for integration test'
32+
required: false
33+
type: string
34+
default: 'eastus2'
35+
36+
permissions:
37+
id-token: write
38+
contents: read
39+
40+
concurrency:
41+
group: publish
42+
cancel-in-progress: false # Don't cancel — mid-publish state is unrecoverable
43+
44+
jobs:
45+
integration-test:
46+
name: All-Resource-Types Integration Test
47+
uses: ./.github/workflows/integration-test.yml
48+
with:
49+
sku: ${{ inputs.sku }}
50+
location: ${{ inputs.location }}
51+
skip_teardown: false
52+
secrets:
53+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
54+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
55+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
56+
APIM_PUBLISHER_EMAIL: ${{ secrets.APIM_PUBLISHER_EMAIL }}
57+
58+
publish:
59+
name: Publish to npm
60+
needs: integration-test
61+
runs-on: ubuntu-latest
62+
environment: npm-publish
63+
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- uses: actions/setup-node@v4
68+
with:
69+
node-version: '22'
70+
cache: 'npm'
71+
registry-url: 'https://registry.npmjs.org'
72+
73+
- run: npm ci
74+
75+
- run: npm run lint
76+
77+
- run: npm test
78+
79+
- run: npm run build
80+
81+
- name: Publish to npm
82+
run: npm publish --access public
83+
env:
84+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)