-
Notifications
You must be signed in to change notification settings - Fork 9
91 lines (89 loc) · 3.37 KB
/
release.yml
File metadata and controls
91 lines (89 loc) · 3.37 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
name: Release
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release Type'
required: true
type: choice
default: 'patch'
options:
- patch
- minor
- major
jobs:
release:
runs-on: macos-latest
steps:
- name: Clone Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0
- name: Setup Node version
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Install VSCE
run: npm install -g @vscode/vsce
- name: Set up secrets
run: |
rm -f src/env-secrets.ts
echo "export const SEGMENT_WRITE_KEY = '${{ secrets.SEGMENT_WRITE_KEY }}'" >> src/env-secrets.ts
- name: Create Changelog
run: |
git log $(git describe --tags --abbrev=0)..HEAD --oneline &> ${{ github.workspace }}-CHANGELOG.txt
cat ${{ github.workspace }}-CHANGELOG.txt
- name: Get Current Version Number
run: |
CURRENT_VERSION=$(git describe --tags --abbrev=0 | sed 's/v//')
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Compile New Version
env:
RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
run: |
RELEASE_VERSION=$(npx semver $CURRENT_VERSION -i $RELEASE_TYPE)
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "Bump to v$RELEASE_VERSION"
- name: Version Package
run: |
git status
npm version $RELEASE_VERSION --no-git-tag-version
git tag -a v$RELEASE_VERSION -m "v$RELEASE_VERSION"
- name: Package Extension
run: vsce package $RELEASE_VERSION --no-git-tag-version --no-update-package-json -o "./releases/codacy-$RELEASE_VERSION.vsix"
- name: Publish to Visual Studio Marketplace
run: vsce publish --packagePath "./releases/codacy-$RELEASE_VERSION.vsix" --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }}
- name: Publish to Open VSX Registry
continue-on-error: true
uses: HaaLeo/publish-vscode-extension@f4ece70f329f66686bd71c54b1671353fe320e49 # v1
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./releases/codacy-${{ env.RELEASE_VERSION }}.vsix
- name: Push Tags
run: |
git log -1 --stat
git push origin main --tags
- run: |
export GIT_TAG=$(git describe --tags --abbrev=0)
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: GitHub Release
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1
with:
artifacts: './releases/codacy-*'
bodyFile: ${{ github.workspace }}-CHANGELOG.txt
tag: ${{ env.GIT_TAG }}
prerelease: false
- name: Send Slack notification
id: slack
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
with:
payload: |
{
"version": "${{ env.RELEASE_VERSION }}",
"releaseType": "${{ github.event.inputs.releaseType }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}