Skip to content
forked from primer/publish

The GitHub Action that publishes Primer packages to visual studio marketplace

License

Notifications You must be signed in to change notification settings

tu6ge/vsce-publish

 
 

Repository files navigation

tu6ge/vsce-publish

This GitHub Action publishes to visual studio marketplace with the following conventions:

  1. If we're on the default branch, the version field is used as-is and we just run vsce publish.
    • After publishing a new version on the default branch, we tag the commit SHA with v{version} via the GitHub API.
    • If the version in package.json is already published, we exit with a 0 code. Previously, we exited with a 78 code, which was Actions v1-speak for "neutral", but this has been removed from Actions v2.
  2. If we're on a release-<version> branch, we publish a release candidate to the next npm dist-tag with the version in the form: <version>-rc.<sha>.
    • A status check is created with the context npm version noting whether the version field in package.json matches the <version> portion of the branch. If it doesn't, the check's status is marked as pending.
  3. Otherwise, we publish a "canary" release, which has a version in the form: 0.0.0-<sha>.

Status checks

Depending on the branch, a series of statuses will be created by this action in your checks: publish is the action's check, and publish {package-name} is a commit status created by the action that reports the version published and links to unpkg.com via "Details":

image FOSSA Status

If you're on a release branch (release-<version>) and the <version> portion of the branch name doesn't match the version field in package.json, you'll get a pending status reminding you to update it:

image

Usage

You will need to provide an azure DevOps access token with publish permissions via the VSCE_PAT secret in the Actions visual editor if you haven't already. The GITHUB_TOKEN secret is also required to create tags after releasing on the master branch.

We suggest that you place this action after any linting and/or testing actions to catch as many errors as possible before publishing.

Actions

To use this in an Actions workflow, add the following YAML to one or more of your steps:

- uses: tu6ge/vsce-publish@master
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    VSCE_PAT: ${{ secrets.VSCE_PAT }}

You can pass additional inputs via the with key:

- name: Publish to the visual studio marketplace
  uses: "tu6ge/vsce-publish@master"
  with:
    npm-args: "--unsafe-perm --allow-same-version"
    default-branch: "main"

Inputs

dry_run No test

Does everything publish would do except actually publishing to the registry. Reports the details of what would have been published.

Default: false

Example

- name: Publish to the visual studio marketplace
  uses: "tu6ge/vsce-publish@master"
  with:
    dry_run: true

dir No test

Accepts a path to the directory that contains the package.json to publish.

Default: .

Example

- name: Publish to the visual studio marketplace
  uses: "tu6ge/vsce-publish@master"
  with:
    dir: "packages/example"
}

default_branch

The branch you'd like to use to trigger releases. Typically this is main or master.

Default: master

- name: Publish to the visual studio marketplace
  uses: "tu6ge/vsce-publish@master"
  with:
    default_branch: "main"

release_tag No test

The release_tag input can be used to override the auto-generated release tag.

Default: latest

- name: Publish to the visual studio marketplace
  uses: "tu6ge/vsce-publish@master"
  with:
    release_tag: "1.0.0"

License

FOSSA Status

About

The GitHub Action that publishes Primer packages to visual studio marketplace

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 90.5%
  • Shell 6.5%
  • Dockerfile 3.0%