Skip to content

Release

Release #25

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'The new version to tag and release'
default: ''
required: true
type: string
prerelease:
description: 'Publish as prerelease'
default: false
type: boolean
changelog-action:
description: 'The action to take on the change log'
options: ['update', 'skip']
required: true
type: choice
jobs:
release:
name: "Build, release, and publish"
runs-on: "ubuntu-latest"
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install Node modules
run: npm ci
- name: Change package version
run: npx json -I -f package.json -e 'this.version="${{ inputs.version }}"'
- name: Compile extension
run: |
if [ "${{ inputs.prerelease }}" = true ] ; then
npm run compile-vsix -- --pre-release
else
npm run compile-vsix
fi
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Update change log
run: |
sed -i 's/\[Unreleased\]/[${{ inputs.version }}] - ${{ steps.date.outputs.date }}/' CHANGELOG.md
- name: Commit and push version
uses: actions-js/push@master
with:
message: "🏷 Bump version to ${{ inputs.version }}"
github_token: ${{ secrets.ACCESS_TOKEN }}
- name: Create Github release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ inputs.version }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Upload extension artifact to Github release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: owlbear-${{ inputs.version }}.vsix
asset_name: owlbear-${{ inputs.version }}.vsix
asset_content_type: vsix
- name: Publish extension
run: |
if [ "${{ inputs.prerelease }}" = true ] ; then
npx vsce publish --pre-release -p ${{ secrets.MARKETPLACE_ACCESS_TOKEN }} -i owlbear-${{ inputs.version }}.vsix
else
npx vsce publish -p ${{ secrets.MARKETPLACE_ACCESS_TOKEN }} -i owlbear-${{ inputs.version }}.vsix
fi