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