Skip to content

Commit a0ebdbd

Browse files
authored
Artifact upload of vsix files without zipping (#1032)
* Artifact upload of vsix files without zipping * Follow artifact naming convention vscode-cmsis-debugger-<os>-<arch>-<version>-<num_of_commits>-g<sha>
1 parent 40cd824 commit a0ebdbd

2 files changed

Lines changed: 21 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ jobs:
8080
exit 1
8181
fi
8282
BASE_TAG=$(printf '%s\n' "${DESCRIBE}" | grep -Eo '^v[0-9]+\.[0-9]+\.[0-9]+')
83+
# For non-release builds, increment the patch version by 1 (e.g. 1.64.1 -> 1.64.2)
84+
NEXT_VERSION="$(printf '%s\n' "${BASE_TAG}" | awk -F. '{ printf "%d.%d.%d", $1, $2, $3 + 1 }')"
8385
PR_QUALIFIER=$(printf '%s\n' "${DESCRIBE}" | grep -Eo '\-g[0-9a-f]+$' || true)
8486
BRANCH_QUALIFIER=$(printf '%s\n' "${DESCRIBE}" | grep -Eo '[0-9]+\-g[0-9a-f]+$' || true)
8587
SAFE_REF_NAME="${{ github.ref_name }}"
@@ -91,13 +93,13 @@ jobs:
9193
npm version --allow-same-version --no-git-tag-version --new-version "${TAG#v}"
9294
;;
9395
pull_request)
94-
npm version -s --allow-same-version --no-git-tag-version --new-version "${BASE_TAG#v}"
95-
PR_VERSION="${BASE_TAG#v}-pr${{ github.event.number }}${PR_QUALIFIER}"
96+
npm version -s --allow-same-version --no-git-tag-version --new-version "${NEXT_VERSION}"
97+
PR_VERSION="${NEXT_VERSION}-${BRANCH_QUALIFIER}"
9698
npm version --no-git-tag-version --new-version "${PR_VERSION}" && echo "Prerelease version set succeeded" || echo "Prerelease version set FAILED with exit code $?"
9799
;;
98100
*)
99-
npm version -s --allow-same-version --no-git-tag-version --new-version "${BASE_TAG#v}"
100-
PR_VERSION="${BASE_TAG#v}-${SAFE_REF_NAME}${BRANCH_QUALIFIER}"
101+
npm version -s --allow-same-version --no-git-tag-version --new-version "${NEXT_VERSION}"
102+
PR_VERSION="${NEXT_VERSION}-${SAFE_REF_NAME}${BRANCH_QUALIFIER}"
101103
npm version --no-git-tag-version --new-version "${PR_VERSION}" && echo "Prerelease version set succeeded" || echo "Prerelease version set FAILED with exit code $?"
102104
;;
103105
esac
@@ -224,8 +226,8 @@ jobs:
224226
- name: Upload package
225227
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
226228
with:
227-
name: vscode-cmsis-debugger-${{ matrix.target }}
228-
path: ./*.vsix
229+
path: ./*${{ matrix.target }}*.vsix
230+
archive: false
229231
retention-days: 1
230232

231233
validate:
@@ -273,7 +275,7 @@ jobs:
273275
- name: Download vsix package
274276
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
275277
with:
276-
pattern: vscode-cmsis-debugger-${{ matrix.target }}
278+
pattern: vscode-cmsis-debugger-${{ matrix.target }}-*.vsix
277279

278280
- name: Validate VSIX contents
279281
shell: bash
@@ -298,7 +300,7 @@ jobs:
298300
- name: Download packages
299301
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
300302
with:
301-
pattern: vscode-cmsis-debugger-*
303+
pattern: vscode-cmsis-debugger-*.vsix
302304

303305
- name: Download coverage report
304306
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

.github/workflows/nightly.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
- platform: macos-14
4545
target: darwin
4646
runs-on: ${{ matrix.platform }}
47+
outputs:
48+
nightly_version: ${{ steps.set_version.outputs.nightly_version }}
4749
permissions:
4850
packages: read
4951
name: 'Build and test (${{ matrix.target }})'
@@ -69,18 +71,19 @@ jobs:
6971
package-manager-cache: false
7072

7173
- name: Set version
74+
id: set_version
7275
if: runner.os == 'Linux' && github.repository_owner == 'Open-CMSIS-Pack'
7376
run: |
7477
DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
7578
QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$' || true)
76-
BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^0-9A-Za-z-]/-/g')
7779
BASE="${DESCRIBE#v}"
7880
IFS='.' read -r MAJ MIN PAT <<< "$BASE"
79-
PR_VERSION="${MAJ}.${MIN}.$((PAT + 1))-${BRANCH}${QUALIFIER:+-${QUALIFIER}}"
81+
PR_VERSION="${MAJ}.${MIN}.$((PAT + 1))${QUALIFIER:+-${QUALIFIER}}"
8082
npm version --no-git-tag-version --new-version "${PR_VERSION}"
8183
VERSION="$(jq -r ".version" < package.json)"
8284
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
8385
echo "Version is ${VERSION}"
86+
echo "nightly_version=${VERSION}" >> $GITHUB_OUTPUT
8487
8588
- name: Remove badges
8689
if: runner.os == 'Linux'
@@ -143,6 +146,8 @@ jobs:
143146
name: Package
144147
runs-on: [ubuntu-latest]
145148
needs: build
149+
env:
150+
NIGHTLY_VERSION: ${{ needs.build.outputs.nightly_version }}
146151
strategy:
147152
fail-fast: true
148153
matrix:
@@ -189,13 +194,13 @@ jobs:
189194
190195
- name: Create vsix package
191196
run: |
192-
npm run package -- --target ${{ matrix.target }}
197+
npm run package -- --target ${{ matrix.target }} --out "vscode-cmsis-debugger-nightly-${{ matrix.target }}-${NIGHTLY_VERSION}.vsix"
193198
194199
- name: Upload package
195200
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
196201
with:
197-
name: vscode-cmsis-debugger-nightly-${{ matrix.target }}
198-
path: ./*.vsix
202+
path: ./*${{ matrix.target }}*.vsix
203+
archive: false
199204
retention-days: 1
200205

201206
validate:
@@ -243,7 +248,7 @@ jobs:
243248
- name: Download vsix package
244249
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
245250
with:
246-
pattern: vscode-cmsis-debugger-nightly-${{ matrix.target }}
251+
pattern: vscode-cmsis-debugger-nightly-${{ matrix.target }}-*.vsix
247252

248253
- name: Validate VSIX contents
249254
shell: bash

0 commit comments

Comments
 (0)