Skip to content

Commit

Permalink
Add automatic publishing to CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TranquilMarmot committed Jul 28, 2020
1 parent f82fdc9 commit 23f16a1
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]

jobs:
ci:
Expand Down Expand Up @@ -39,3 +41,10 @@ jobs:

- name: Tests
run: npm run test

# This only gets run if we're pushing a new tag that starts with "v"
- name: Publish
if: success() && startsWith(github.ref, 'refs/tags/v')
run: npm run publish
env:
VSCE_PAT: ${{ secrets.VSCE_DEPLOY_KEY }}
19 changes: 18 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This document outlines how to contribute to this project, as well as an overview
- [How to Contribute](#how-to-contribute)
- [Available scripts](#available-scripts)
- [CI/CD](#cicd)
- [Releases](#releases)
- [Automatic Release](#automatic-release)
- [Manual Release](#manual-release)
- [Packaging the extension](#packaging-the-extension)
- [Project Layout](#project-layout)
- [`loom-common`](#loom-common)
Expand Down Expand Up @@ -68,7 +71,21 @@ Because of the way that [lerna](https://lerna.js.org/) works, most scripts canno

Every pull request and merge to the `main` branch has the [`continuous-integration-workflow.yml`](./.github/workflows/continuous-integration-workflow.yml) run against it.

TODO: CD for automatic releases
#### Releases

Running `npm run version` in the root of the repo will ask for a new version via lerna. This will bump all of the `package.json` files.

`npm install` must then be run to update all of the `package-lock.json` files.

##### Automatic Release

Creating a [new release from GitHub](https://github.com/TranquilMarmot/YarnLoom/releases) should trigger the [`continuous-integration-workflow.yml`](./.github/workflows/continuous-integration-workflow.yml) and publish the extension. The deploy key that `vsce` uses to deploy the extension is stored as an encrypted secret in the repo's settings.

##### Manual Release

The steps in the [Visual Studio Code "Publishing Extensions" docs](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) should be followed to create a personal access token (PAT) in Azure Dev Ops in order to use `vsce` to publish the extension.

Once logged in to the publisher via `vsce`, running `npm run publish` from the root of the repo will publish the current version of the extension.

### Packaging the extension

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Yarn Loom is a Visual Studio Code extension for editing [yarn files](https://yar

## Installing

- TODO Visual Studio Code marketplace link
- TODO Install from `.vsix` build artifacts
This extension can be installed from the [Visual Studio Code Extension Marketplace](https://marketplace.visualstudio.com/items?itemName=TranquilMarmot.yarn-spinner-loom)

## Usage

Expand Down
4 changes: 1 addition & 3 deletions loom-common/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"name": "loom-common",
"version": "1.0.1",
"description": "",
"author": "",
"license": "ISC",
"private": true,
"scripts": {
"build": "rm -rf out && tsc -p ./ && cp package.json ./out",
"test": "jest",
Expand Down
2 changes: 1 addition & 1 deletion loom-extension/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Yarn Spinner Loom

<p align="center">
<img src="./icon.png" alt="Yarn Loom Logo" />
<img src="https://github.com/TranquilMarmot/YarnLoom/raw/main/loom-extension/icon.png" alt="Yarn Loom Logo" />
</P>

Yarn Loom is a Visual Studio Code extension for editing [yarn files](https://yarnspinner.dev/). It is a re-imagining of the [Yarn Editor](https://github.com/YarnSpinnerTool/YarnEditor) built from the ground up to integrate seamlessly with Visual Studio Code.
Expand Down
5 changes: 3 additions & 2 deletions loom-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"publisher": "TranquilMarmot",
"icon": "icon.png",
"galleryBanner": {
"color": "#37895F",
"color": "#235C3F",
"theme": "dark"
},
"badges": [
Expand Down Expand Up @@ -100,7 +100,8 @@
"lint": "eslint -c .eslintrc.js --ext .ts ./",
"watch": "tsc -watch -p ./",
"test": "jest",
"package": "vsce package"
"package": "vsce package",
"publish": "vsce publish"
},
"dependencies": {
"rimraf": "^3.0.2",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
"test:editor": "cross-env CI=true lerna run --scope loom-editor test",
"test": "cross-env CI=true lerna run test",
"package": "lerna run --scope yarn-spinner-loom package",
"publish": "npm run build && lerna run --scope yarn-spinner-loom publish",
"prettier": "prettier --write **/*.{js,ts,tsx,md,json}",
"lint:common": "lerna run --scope loom-common lint",
"lint:editor": "lerna run --scope loom-editor lint",
"lint:extension": "lerna run --scope yarn-spinner-loom lint",
"lint": "prettier --check **/*.{js,ts,tsx,md,json} && lerna run lint"
"lint": "prettier --check **/*.{js,ts,tsx,md,json} && lerna run lint",
"version": "lerna version --no-push"
},
"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
Expand Down

0 comments on commit 23f16a1

Please sign in to comment.