Skip to content

Release

Release #3

Workflow file for this run

name: Release
on:
workflow_run:
workflows: ["Test and Build VSCode"]
types:
- completed
jobs:
package:
name: Package
runs-on: ubuntu-latest
outputs:
packageName: ${{ steps.setup.outputs.packageName }}
tag: ${{ steps.setup-tag.outputs.tag }}
version: ${{ steps.setup-tag.outputs.version }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ steps.node_version.outputs.nvmrc }}
- name: Install dependencies
run: npm i
- name: Install vsce
run: npm install -g @vscode/vsce
- name: Setup package path
id: setup
run: echo "::set-output name=packageName::$(node -e "console.log(require('./package.json').name + '-' + require('./package.json').version + '.vsix')")"
- name: Package
env:
VSIX_PACKAGE_PATH: ${{ steps.setup.outputs.packageName }}
run: vsce package
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.setup.outputs.packageName }}
path: ${{ steps.setup.outputs.packageName }}
- name: Setup tag
id: setup-tag
run: |
version=$(node -p "require('./package.json').version")
majorVersion=$(echo $version | cut -d '.' -f 1)
echo "tag: release/$majorVersion"
echo "::set-output name=tag::release/$majorVersion"
echo "::set-output name=version::$version"
shell: bash
publishGH:
name: Publish to GitHub releases
runs-on: ubuntu-latest
needs: package
if: startsWith(needs.package.outputs.tag, 'release/') && needs.package.outputs.tag != github.ref
steps:
- uses: actions/download-artifact@v2
with:
name: ${{ needs.package.outputs.packageName }}
- name: Commit tagger
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.package.outputs.tag }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.package.outputs.tag }}
release_name: Release ${{ needs.package.outputs.version }}
draft: false
prerelease: false
- name: Upload assets to a Release
uses: AButler/[email protected]
with:
files: ${{ needs.package.outputs.packageName }}
release-tag: ${{ needs.package.outputs.tag }}
repo-token: ${{ secrets.GITHUB_TOKEN }}