forked from vivaxy/vscode-conventional-commits
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (91 loc) · 3.54 KB
/
Copy pathrelease.yml
File metadata and controls
107 lines (91 loc) · 3.54 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- CHANGELOG.md
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
with:
fetch-depth: 0
- name: Setup nodejs
uses: actions/setup-node@v3.6.0
with:
node-version: 14
- name: Setup package
run: yarn install
- name: Bump version
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
yarn standard-version --skip.commit --skip.tag
sed 's/^### \[/## [/' -i CHANGELOG.md
yarn prettier --write CHANGELOG.md --prose-wrap never --ignore-path ./gitignore
- name: Get version from package.json
uses: actions/github-script@v6.4.0
id: version
with:
result-encoding: string
script: |
const { GITHUB_WORKSPACE } = process.env;
const version = require(`${GITHUB_WORKSPACE}/package.json`).version;
core.setOutput('repo', context.repo.repo);
core.setOutput('version', version);
- name: Setup git information
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Create commit
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
git add .
git commit -m "chore(release): :bookmark: release v${{steps.version.outputs.version}}"
- name: Create tag
run: |
git tag -a v${{steps.version.outputs.version}} -m "chore(release): :bookmark: release v${{steps.version.outputs.version}}"
- name: Build release asset
run: yarn build
- name: Publish package to visual studio marketplace
run: yarn deploy -p ${{secrets.VSCE_PAT}}
- name: Publish package to open VSX registry
env:
FILENAME: ${{steps.version.outputs.repo}}-${{steps.version.outputs.version}}.vsix
run: yarn ovsx publish ${{env.FILENAME}} -p ${{secrets.OPEN_VSX_TOKEN}}
- name: Push release commit
env:
REMOTE_URL: https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git
run: |
git push --follow-tags "${{env.REMOTE_URL}}"
- name: Get changelog context
id: changelog_reader
uses: mindsers/changelog-reader-action@v2.2.2
with:
version: ${{steps.version.outputs.version}}
path: ./CHANGELOG.md
- name: Create release
id: create_release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: v${{steps.version.outputs.version}}
release_name: Release v${{steps.version.outputs.version}}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease:
${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
- name: Upload release asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ./${{steps.version.outputs.repo}}-${{steps.version.outputs.version}}.vsix
asset_name: ${{steps.version.outputs.repo}}-${{steps.version.outputs.version}}.vsix
asset_content_type: application/octet-stream