Skip to content

Release

Release #62

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version number
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Create a release branch
run: |
git checkout -b release
git push -u origin release
- name: Install Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Set the version in package.json
run: node scripts/set-version.js ${{ github.event.inputs.version }}
- name: Create a release commit
uses: EndBug/add-and-commit@v9.1.4
with:
add: 'package.json'
commit: '--signoff'
message: Release v${{ github.event.inputs.version }}
push: false
- name: Get the Yarn cache directory
id: yarn-cache
run: |
echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn dependencies
uses: actions/cache@v3.3.2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Yarn dependencies
run: yarn install
- name: Package the extension
run: yarn package
- name: Create tag
uses: mathieudutour/github-tag-action@v6.2
with:
custom_tag: ${{ github.event.inputs.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
release_name: v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
- name: Attach artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/octet-stream
asset_name: dodona-plugin-vscode-${{ github.event.inputs.version }}.vsix
asset_path: ./dodona-plugin-vscode-${{ github.event.inputs.version }}.vsix
upload_url: ${{ steps.release.outputs.upload_url }}
- name: Publish to Azure Marketplace
run: yarn run vscode:publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Prepare package.json for next version
run: node scripts/prepare-next-snapshot.js
- name: Push new development commit
uses: EndBug/add-and-commit@v9.1.4
with:
add: 'package.json'
commit: '--signoff'
message: 'Prepare next development cycle'
- name: Open a pull request
uses: repo-sync/pull-request@v2
with:
destination_branch: "master"
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: Release v${{ github.event.inputs.version }}
source_branch: release