Skip to content

Merge pull request #551 from PlasticSCM/dependabot/npm_and_yarn/types… #124

Merge pull request #551 from PlasticSCM/dependabot/npm_and_yarn/types…

Merge pull request #551 from PlasticSCM/dependabot/npm_and_yarn/types… #124

Workflow file for this run

name: Release
on:
push:
branches: [ master ]
jobs:
release:
name: Release extension to Marketplace
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, 'release:trigger')
defaults:
run:
working-directory: ${{ github.workspace }}
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: clean install dependencies
run: npm ci
- name: fetch all history and tags for gitversion
run: git fetch --prune --unshallow
- name: install gitversion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.0.x'
- name: execute gitversion
id: gitversion-before
uses: gittools/actions/gitversion/[email protected]
- name: print gitversion before release
run: |
echo "Major: ${{ steps.gitversion-before.outputs.major }}"
echo "Minor: ${{ steps.gitversion-before.outputs.minor }}"
echo "Patch: ${{ steps.gitversion-before.outputs.patch }}"
echo "MajorMinorPatch: ${{ steps.gitversion-before.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion-before.outputs.semVer }}"
- name: update version in package.json
run: |
sed -e '/"version"/s/: ".*"/: "${{ steps.gitversion-before.outputs.semVer }}"/' package.json | tee package.json.modified
mv package.json.modified package.json
- name: compile and create vsix
run: npm run package
- name: publish to marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: npm run deploy
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.gitversion-before.outputs.semVer }}
release_name: v${{ steps.gitversion-before.outputs.semVer }}
body: |
# ${{ steps.gitversion-before.outputs.semVer }} - ${{ steps.date.outputs.date }}
- name: upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./plastic-scm-${{ steps.gitversion-before.outputs.semVer }}.vsix
asset_name: plastic-scm-${{ steps.gitversion-before.outputs.semVer }}.vsix
asset_content_type: application/zip
- name: fetch new tag for gitversion
run: git fetch
- name: bump version by using an empty commit
run: |
git config --global user.name 'Plastic SCM Releases'
git config --global user.email '[email protected]'
git commit --allow-empty -s -m 'Empty commit to bump version'
- name: execute gitversion again
id: gitversion-after
uses: gittools/actions/gitversion/[email protected]
- name: print gitversion after release
run: |
echo "Major: ${{ steps.gitversion-after.outputs.major }}"
echo "Minor: ${{ steps.gitversion-after.outputs.minor }}"
echo "Patch: ${{ steps.gitversion-after.outputs.patch }}"
echo "MajorMinorPatch: ${{ steps.gitversion-after.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion-after.outputs.semVer }}"
- name: update new version in package.json
run: |
sed -e '/"version"/s/: ".*"/: "${{ steps.gitversion-after.outputs.semVer }}"/' package.json | tee package.json.modified
mv package.json.modified package.json
- name: create pull request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
commit-message: '[create-pull-request] Bump version to ${{ steps.gitversion-after.outputs.semVer }}'
title: >
Bump version
from ${{ steps.gitversion-before.outputs.semVer }}
to ${{ steps.gitversion-after.outputs.semVer }}
body: |
Release `${{ steps.gitversion-before.outputs.semVer }}` was successful!
Let's make it official and update that version number.
Since this PR is triggered from inside a workflow, GitHub prevents it from
triggering other workflows (e.g. CI) to avoid recursive workflow runs.
[See more info here](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token).
As a workaround, checkout that PR branch and push an empty commit to it.
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
labels: release, automated
branch: bump-version-${{ steps.gitversion-after.outputs.semVer }}
- name: print PR number
run: |
echo 'Created pull request #${{ steps.cpr.outputs.pull-request-number }}'