-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (110 loc) · 4.67 KB
/
Copy pathrelease-version-alignment.yml
File metadata and controls
135 lines (110 loc) · 4.67 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release Version Alignment
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
jobs:
publish-and-label:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Run lint checks
run: npm run lint
- name: Build dist assets
run: npm run build
- name: Run unit tests
run: npm run test:unit
- name: Install Playwright browser
run: npm run test:e2e:install:ci
- name: Run Playwright tests
run: npm run test:e2e
- name: Run curated visual checks
run: npm run test:visual
- name: Run full UI matrix
run: npm run test:matrix
- name: Resolve immutable ecosystem fixture sources
id: ecosystem_sources
shell: bash
run: node scripts/write-ecosystem-workflow-outputs.mjs
- name: Checkout Layout Style CSS contract fixture
uses: actions/checkout@v6
with:
repository: ${{ steps.ecosystem_sources.outputs.layout_repository }}
ref: ${{ steps.ecosystem_sources.outputs.layout_revision }}
path: _ecosystem/Layout-Style-CSS
- name: Checkout Interactive Surface CSS contract fixture
uses: actions/checkout@v6
with:
repository: ${{ steps.ecosystem_sources.outputs.interactive_repository }}
ref: ${{ steps.ecosystem_sources.outputs.interactive_revision }}
path: _ecosystem/Interactive-Surface-CSS
- name: Install Layout Style CSS fixture dependencies
working-directory: _ecosystem/Layout-Style-CSS
run: npm ci
- name: Install Interactive Surface CSS fixture dependencies
working-directory: _ecosystem/Interactive-Surface-CSS
run: npm ci
# Explicit candidate mode exempts only the UI tag under review while retaining every published companion check.
- name: Run ecosystem release preflight
run: npm run release:preflight -- --candidate-package ui-style-kit-css --layout-repo $GITHUB_WORKSPACE/_ecosystem/Layout-Style-CSS --interactive-repo $GITHUB_WORKSPACE/_ecosystem/Interactive-Surface-CSS --layout-docs-repo $GITHUB_WORKSPACE/_ecosystem/Layout-Style-CSS --interactive-docs-repo $GITHUB_WORKSPACE/_ecosystem/Interactive-Surface-CSS
- name: Restrict manual runs to main
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
shell: bash
run: |
echo "::error::workflow_dispatch is only allowed from refs/heads/main."
exit 1
- name: Resolve release version
id: version
shell: bash
run: |
set -euo pipefail
PACKAGE_NAME="$(node -p "require('./package.json').name")"
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
EXPECTED_TAG="v${PACKAGE_VERSION}"
if [[ "${GITHUB_REF_TYPE:-}" == "tag" && "${GITHUB_REF_NAME}" != "${EXPECTED_TAG}" ]]; then
echo "::error::Tag '${GITHUB_REF_NAME}' must match package version tag '${EXPECTED_TAG}'."
exit 1
fi
if ! grep -qE "^## \\[${PACKAGE_VERSION//./\\.}\\] - " CHANGELOG.md; then
echo "::error::CHANGELOG.md is missing an entry for version ${PACKAGE_VERSION}."
exit 1
fi
echo "package_name=${PACKAGE_NAME}" >> "$GITHUB_OUTPUT"
echo "package_version=${PACKAGE_VERSION}" >> "$GITHUB_OUTPUT"
echo "expected_tag=${EXPECTED_TAG}" >> "$GITHUB_OUTPUT"
- name: Create tag on manual run
if: github.event_name == 'workflow_dispatch'
shell: bash
env:
EXPECTED_TAG: ${{ steps.version.outputs.expected_tag }}
run: |
set -euo pipefail
if git rev-parse -q --verify "refs/tags/${EXPECTED_TAG}" >/dev/null; then
echo "Tag ${EXPECTED_TAG} already exists."
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "${EXPECTED_TAG}"
git push origin "${EXPECTED_TAG}"
echo "Created and pushed tag ${EXPECTED_TAG}."
fi
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.expected_tag }}
name: ${{ steps.version.outputs.expected_tag }}
generate_release_notes: true