Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(actions): 👷 add CI to build package and release #57

Merged
merged 5 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: release

on:
push:
branches:
- master
paths:
- CHANGELOG.md

jobs:
run:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Generate Package
run: |
yarn install
yarn run build

- name: Get changelog content
id: changelog_reader
uses: mindsers/[email protected]
with:
path: ./CHANGELOG.md

- name: Create release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.changelog_reader.outputs.version }}
release_name: Release v${{ steps.changelog_reader.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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path:
./vscode-conventional-commits-${{
steps.changelog_reader.outputs.version }}.vsix
asset_name:
vscode-conventional-commits-${{
steps.changelog_reader.outputs.version }}.vsix
asset_content_type: application/octet-stream
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
out
yarn-error.log
.DS_Store
*.vsix
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"release": "standard-version && vsce publish && git push --follow-tags",
"version": "standard-version && git push --follow-tags",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Where is version command used?
  • I think version in npm scripts will be triggered when npm version run. See npm pre--post-scripts. Is it intentional to do so, or not?
  • Now version is almost the same to release, is it possible to update release command to npm run version && vsce publish?

"build": "vsce package",
"postinstall": "husky install",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable"
Expand Down