-
-
Notifications
You must be signed in to change notification settings - Fork 8
75 lines (64 loc) · 2.5 KB
/
cd.yml
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
name: CD
on: create
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VSCE_PAT: ${{secrets.VSCE_PAT}}
jobs:
deploy:
if: (github.event.ref_type == 'tag') && (startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
# Make sure the version number in the tag matches the version in package.json
- name: match-tag-to-package-version
uses: geritol/[email protected] # https://github.com/geritol/match-tag-to-package-version
env:
TAG_PREFIX: refs/tags/v
# Parse the version number from the new tag
- name: Get version
id: semver
uses: LykkeBusiness/[email protected]
with:
tag: ${{ github.ref }}
# Update the 'latest' tag
- name: Tag latest
uses: richardsimko/update-tag@v1
with:
tag_name: latest
# Install deps, compile, and pack into .vsix
- name: Build
run: |
npm install
npx tsc --project src
npm install --no-save vsce
npx vsce --version
npx vsce package --out ./gcode.vsix
# Read the changelog entry corresponding to the new version number
- name: Read entry from changelog
uses: mindsers/changelog-reader-action@v2 # https://github.com/mindsers/changelog-reader-action
id: changelog_reader
with:
version: ${{ steps.semver.outputs.prefixed }}
# Create a new release on GitHub
- name: Create a release
uses: actions/create-release@v1 # https://github.com/actions/create-release/
id: create_release
with:
tag_name: ${{ steps.semver.outputs.prefixed }}
release_name: Release ${{ steps.semver.outputs.prefixed }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: false
# Upload the vsix to the release
- name: Attach vsix
uses: actions/upload-release-asset@v1 # https://github.com/actions/upload-release-asset
id: upload-release-asset
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gcode.vsix
asset_name: gcode-${{ steps.semver.outputs.prefixed }}.vsix
asset_content_type: application/vsix
# Publish the .vsix to the marketplace
- name: Publish to marketplace
run: npx vsce publish --packagePath gcode.vsix