|
1 | | -name: CI |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - main |
10 | | - workflow_dispatch: |
11 | | - merge_group: |
12 | | - release: |
13 | | - types: [published] |
14 | | - |
15 | | -concurrency: |
16 | | - group: ${{ github.workflow }}-${{ github.ref }} |
17 | | - cancel-in-progress: true |
18 | | - |
19 | | -permissions: |
20 | | - contents: read |
21 | | - |
22 | | -jobs: |
23 | | - build: |
24 | | - name: Build and test |
25 | | - runs-on: [ubuntu-latest] |
26 | | - steps: |
27 | | - - name: Harden the runner (Audit all outbound calls) |
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - '**/*.md' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + paths-ignore: |
| 13 | + - '**/*.md' |
| 14 | + workflow_dispatch: |
| 15 | + merge_group: |
| 16 | + release: |
| 17 | + types: [published] |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read |
| 25 | + |
| 26 | +jobs: |
| 27 | + build: |
| 28 | + name: Build and test |
| 29 | + runs-on: [ubuntu-latest] |
| 30 | + steps: |
| 31 | + - name: Harden the runner (Audit all outbound calls) |
28 | 32 | uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
29 | | - with: |
30 | | - egress-policy: audit |
31 | | - |
32 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
33 | | - with: |
34 | | - fetch-depth: 0 |
35 | | - submodules: true |
36 | | - |
37 | | - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
38 | | - with: |
39 | | - node-version-file: package.json |
40 | | - registry-url: https://npm.pkg.github.com |
41 | | - always-auth: true |
42 | | - cache: 'yarn' |
43 | | - |
44 | | - - name: Set version |
45 | | - if: github.repository_owner == 'Open-CMSIS-Pack' |
46 | | - run: | |
47 | | - case ${{ github.event_name }} in |
48 | | - release) |
49 | | - TAG="${{ github.event.release.tag_name }}" |
50 | | - yarn version --no-git-tag-version --new-version "${TAG#v}" |
51 | | - ;; |
52 | | - pull_request) |
53 | | - DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+') |
54 | | - QUALIFIER=$(git describe --tags | grep -Eo '\-g[0-9a-f]+$') |
55 | | - yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}" |
56 | | - yarn version --no-git-tag-version --prepatch --preid "pr${{ github.event.number }}${QUALIFIER}" |
57 | | - ;; |
58 | | - *) |
59 | | - DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+') |
60 | | - QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$') |
61 | | - yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}" |
62 | | - yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}${QUALIFIER}" |
63 | | - ;; |
64 | | - esac |
65 | | - VERSION="$(jq -r ".version" < package.json)" |
66 | | - sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md |
67 | | - echo "Version is ${VERSION}" |
68 | | -
|
69 | | - - name: Remove Badges for dist |
70 | | - run: | |
71 | | - sed -i "/https:\/\/qlty\.sh\/gh/d" README.md |
72 | | - sed -i "/https:\/\/securityscorecards\.dev\/viewer/d" README.md |
73 | | -
|
74 | | - - name: Build |
75 | | - env: |
76 | | - GITHUB_TOKEN: ${{github.token}} |
77 | | - run: yarn --frozen-lockfile --prefer-offline |
78 | | - |
79 | | - - name: Test |
80 | | - run: yarn test |
81 | | - |
82 | | - - name: Upload dist |
83 | | - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
84 | | - with: |
85 | | - name: dist |
86 | | - path: | |
87 | | - ./README.md |
88 | | - ./CHANGELOG.md |
89 | | - ./package.json |
90 | | - ./dist |
91 | | - retention-days: 1 |
92 | | - |
93 | | - - name: Commit changelog |
94 | | - if: false && github.event_name == 'release' |
95 | | - run: | |
96 | | - sed -i '3i ## Unreleased\n' CHANGELOG.md |
97 | | - git checkout main |
98 | | - git config user.name github-actions |
99 | | - git config user.email [email protected] |
100 | | - git add CHANGELOG.md |
101 | | - git commit -m "Update CHANGELOG.md after release [skip ci]" |
102 | | - git push |
103 | | -
|
104 | | - - name: Publish coverage report to QLTY |
105 | | - if: github.repository_owner == 'Open-CMSIS-Pack' |
106 | | - uses: qltysh/qlty-action/coverage@f13b3559771beedd11e68b03d49512f3c21a75ba # v1 |
107 | | - with: |
108 | | - token: ${{ secrets.QLTY_COVERAGE_TOKEN }} |
109 | | - files: coverage/lcov.info |
110 | | - |
111 | | - package: |
112 | | - name: Package |
113 | | - runs-on: [ubuntu-latest] |
114 | | - needs: build |
115 | | - strategy: |
116 | | - fail-fast: true |
117 | | - matrix: |
118 | | - target: |
119 | | - - win32-x64 |
120 | | - - linux-x64 |
121 | | - - linux-arm64 |
122 | | - - darwin-arm64 |
123 | | - steps: |
124 | | - - name: Harden the runner (Audit all outbound calls) |
| 33 | + with: |
| 34 | + egress-policy: audit |
| 35 | + |
| 36 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 37 | + with: |
| 38 | + fetch-depth: 0 |
| 39 | + submodules: true |
| 40 | + |
| 41 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 42 | + with: |
| 43 | + node-version-file: package.json |
| 44 | + registry-url: https://npm.pkg.github.com |
| 45 | + always-auth: true |
| 46 | + cache: 'yarn' |
| 47 | + |
| 48 | + - name: Set version |
| 49 | + if: github.repository_owner == 'Open-CMSIS-Pack' |
| 50 | + run: | |
| 51 | + case ${{ github.event_name }} in |
| 52 | + release) |
| 53 | + TAG="${{ github.event.release.tag_name }}" |
| 54 | + yarn version --no-git-tag-version --new-version "${TAG#v}" |
| 55 | + ;; |
| 56 | + pull_request) |
| 57 | + DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+') |
| 58 | + QUALIFIER=$(git describe --tags | grep -Eo '\-g[0-9a-f]+$') |
| 59 | + yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}" |
| 60 | + yarn version --no-git-tag-version --prepatch --preid "pr${{ github.event.number }}${QUALIFIER}" |
| 61 | + ;; |
| 62 | + *) |
| 63 | + DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+') |
| 64 | + QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$') |
| 65 | + yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}" |
| 66 | + yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}${QUALIFIER}" |
| 67 | + ;; |
| 68 | + esac |
| 69 | + VERSION="$(jq -r ".version" < package.json)" |
| 70 | + sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md |
| 71 | + echo "Version is ${VERSION}" |
| 72 | +
|
| 73 | + - name: Remove Badges for dist |
| 74 | + run: | |
| 75 | + sed -i "/https:\/\/qlty\.sh\/gh/d" README.md |
| 76 | + sed -i "/https:\/\/securityscorecards\.dev\/viewer/d" README.md |
| 77 | +
|
| 78 | + - name: Build |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{github.token}} |
| 81 | + run: yarn --frozen-lockfile --prefer-offline |
| 82 | + |
| 83 | + - name: Test |
| 84 | + run: yarn test |
| 85 | + |
| 86 | + - name: Upload dist |
| 87 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 88 | + with: |
| 89 | + name: dist |
| 90 | + path: | |
| 91 | + ./README.md |
| 92 | + ./CHANGELOG.md |
| 93 | + ./package.json |
| 94 | + ./dist |
| 95 | + retention-days: 1 |
| 96 | + |
| 97 | + - name: Commit changelog |
| 98 | + if: false && github.event_name == 'release' |
| 99 | + run: | |
| 100 | + sed -i '3i ## Unreleased\n' CHANGELOG.md |
| 101 | + git checkout main |
| 102 | + git config user.name github-actions |
| 103 | + git config user.email [email protected] |
| 104 | + git add CHANGELOG.md |
| 105 | + git commit -m "Update CHANGELOG.md after release [skip ci]" |
| 106 | + git push |
| 107 | +
|
| 108 | + - name: Publish coverage report to QLTY |
| 109 | + if: github.repository_owner == 'Open-CMSIS-Pack' |
| 110 | + uses: qltysh/qlty-action/coverage@f13b3559771beedd11e68b03d49512f3c21a75ba # v1 |
| 111 | + with: |
| 112 | + token: ${{ secrets.QLTY_COVERAGE_TOKEN }} |
| 113 | + files: coverage/lcov.info |
| 114 | + |
| 115 | + package: |
| 116 | + name: Package |
| 117 | + runs-on: [ubuntu-latest] |
| 118 | + needs: build |
| 119 | + strategy: |
| 120 | + fail-fast: true |
| 121 | + matrix: |
| 122 | + target: |
| 123 | + - win32-x64 |
| 124 | + - linux-x64 |
| 125 | + - linux-arm64 |
| 126 | + - darwin-arm64 |
| 127 | + steps: |
| 128 | + - name: Harden the runner (Audit all outbound calls) |
125 | 129 | uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
126 | | - with: |
127 | | - egress-policy: audit |
128 | | - |
129 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
130 | | - |
131 | | - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
132 | | - with: |
133 | | - node-version-file: package.json |
134 | | - registry-url: https://npm.pkg.github.com |
135 | | - always-auth: true |
136 | | - cache: 'yarn' |
137 | | - |
138 | | - - name: Download dist |
139 | | - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
140 | | - with: |
141 | | - name: dist |
142 | | - path: . |
143 | | - |
144 | | - - name: Cache tools |
145 | | - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.6 |
146 | | - with: |
147 | | - path: tools |
148 | | - key: tools-${{ matrix.target }}-${{ github.head_ref || github.ref_name }} |
149 | | - restore-keys: | |
150 | | - tools-${{ matrix.target }}-${{ github.base_ref || 'main' }} |
151 | | - tools-${{ matrix.target }}- |
152 | | -
|
153 | | - - name: Download tools |
154 | | - run: | |
155 | | - yarn --frozen-lockfile --ignore-scripts --prefer-offline |
156 | | - yarn download-tools --target ${{ matrix.target }} --no-cache |
157 | | -
|
158 | | - - name: Create vsix package |
159 | | - run: | |
160 | | - yarn package --target ${{ matrix.target }} |
161 | | -
|
162 | | - - name: Upload package |
163 | | - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
164 | | - with: |
165 | | - name: vsix-package-${{ matrix.target }} |
166 | | - path: ./*.vsix |
167 | | - retention-days: 1 |
168 | | - |
169 | | - publish: |
170 | | - name: Publish release |
171 | | - runs-on: [ubuntu-latest] |
172 | | - if: github.event_name == 'release' |
173 | | - needs: package |
174 | | - permissions: |
175 | | - contents: write # for softprops/action-gh-release to create a GitHub release |
176 | | - steps: |
177 | | - - name: Harden the runner (Audit all outbound calls) |
| 130 | + with: |
| 131 | + egress-policy: audit |
| 132 | + |
| 133 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 134 | + |
| 135 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 136 | + with: |
| 137 | + node-version-file: package.json |
| 138 | + registry-url: https://npm.pkg.github.com |
| 139 | + always-auth: true |
| 140 | + cache: 'yarn' |
| 141 | + |
| 142 | + - name: Download dist |
| 143 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
| 144 | + with: |
| 145 | + name: dist |
| 146 | + path: . |
| 147 | + |
| 148 | + - name: Cache tools |
| 149 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.6 |
| 150 | + with: |
| 151 | + path: tools |
| 152 | + key: tools-${{ matrix.target }}-${{ github.head_ref || github.ref_name }} |
| 153 | + restore-keys: | |
| 154 | + tools-${{ matrix.target }}-${{ github.base_ref || 'main' }} |
| 155 | + tools-${{ matrix.target }}- |
| 156 | +
|
| 157 | + - name: Download tools |
| 158 | + run: | |
| 159 | + yarn --frozen-lockfile --ignore-scripts --prefer-offline |
| 160 | + yarn download-tools --target ${{ matrix.target }} --no-cache |
| 161 | +
|
| 162 | + - name: Create vsix package |
| 163 | + run: | |
| 164 | + yarn package --target ${{ matrix.target }} |
| 165 | +
|
| 166 | + - name: Upload package |
| 167 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 168 | + with: |
| 169 | + name: vsix-package-${{ matrix.target }} |
| 170 | + path: ./*.vsix |
| 171 | + retention-days: 1 |
| 172 | + |
| 173 | + publish: |
| 174 | + name: Publish release |
| 175 | + runs-on: [ubuntu-latest] |
| 176 | + if: github.event_name == 'release' |
| 177 | + needs: package |
| 178 | + permissions: |
| 179 | + contents: write # for softprops/action-gh-release to create a GitHub release |
| 180 | + steps: |
| 181 | + - name: Harden the runner (Audit all outbound calls) |
178 | 182 | uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
179 | | - with: |
180 | | - egress-policy: audit |
181 | | - |
182 | | - - name: Download packages |
183 | | - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
184 | | - with: |
185 | | - pattern: vsix-package-* |
186 | | - |
187 | | - - name: Attach packages |
| 183 | + with: |
| 184 | + egress-policy: audit |
| 185 | + |
| 186 | + - name: Download packages |
| 187 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
| 188 | + with: |
| 189 | + pattern: vsix-package-* |
| 190 | + |
| 191 | + - name: Attach packages |
188 | 192 | uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2 |
189 | | - with: |
190 | | - files: "**/*.vsix" |
| 193 | + with: |
| 194 | + files: "**/*.vsix" |
0 commit comments