diff --git a/.github/workflows/release-tag-bump-version.sh b/.github/workflows/release-tag-bump-version.sh new file mode 100755 index 0000000..e01a4b3 --- /dev/null +++ b/.github/workflows/release-tag-bump-version.sh @@ -0,0 +1,42 @@ +prevVer=$(node -p "require('./package.json').version") +echo "Current version: $prevVer" + +msgs=$(git log --oneline $(git describe --tags --abbrev=0)..HEAD) + +#echo ${msgs,,} + +if [[ ${msgs,,} =~ (fix:|refactoring:) ]]; then + echo "--> Bump patch version to " + npm --no-git-tag-version version patch +#else +# echo "no 'fix:' or 'refactoring:' commit message found.." +fi + +if [[ ${msgs,,} =~ feat: ]]; then + echo "--> Bump minor version to " + npm --no-git-tag-version version minor +#else +# echo "no 'feat:' commit meassage found.." +fi + +if [[ ${msgs,,} =~ (breaking change:|!:) ]]; then + echo "--> Bump major version to " + npm --no-git-tag-version version major +#else +# echo "no 'BREAKING CHANGE' or '!' found.." +fi + +newVer=$(node -p "require('./package.json').version") +echo "New version: $newVer" + +if [[ "$prevVer" == "$newVer" ]]; then + message="Unable to find actual version changes. Did you use proper conventional commit messages? Available types/scopes: 'fix:', 'refactoring:', 'feat:', 'breaking changes:' or '!:'" + echo "::error file=${name},line=${line},endLine=${endLine},title=${title}::${message}" + exit 1 +fi + +if [[ ! "$(cat CHANGELOG.md)" =~ "$newVer" ]]; then + message='Unable to find new version in CHANGELOG.md. Do proper changes and rerun this job!' + echo "::error file=${name},line=${line},endLine=${endLine},title=${title}::${message}" + exit 1 +fi diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 0000000..b41fc91 --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,43 @@ +name: Release tag before publish +on: workflow_dispatch +jobs: + release-tag: + name: Create new release tag + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + ref: ${{ github.ref }} + fetch-depth: 0 + fetch-tags: true + + - name: Install npm eslint + run: npm install -g eslint + + - name: npm install packages + run: npm install + + - name: Bump version + run: .github/workflows/release-tag-bump-version.sh + + - name: clean + run: rm -f debugger/*.lua; rm -f debugger/*.lua.map; rm -f extension/*.js; rm -f extension/*.js.map; rm -f *.vsix + + - name: npm run lint, build and vsce package within npm run bundle + run: npm run bundle + + - name: Provide proper artifact name + run: | + echo "artifact_name=$(find second-local-lua-debugger-vscode-*)" >> $GITHUB_ENV + + - name: Create and push new release tag + run: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + releaseVer=$(node -p "require('./package.json').version") + git tag -a release-v$releaseVer -m 'Bump new release version release-v$releaseVer before publish'; git push origin release-v$releaseVer; git push origin --tags + + - uses: actions/upload-artifact@v4 + with: + name: ${{ env.artifact_name }} + path: second-local-lua-debugger-vscode-*.vsix \ No newline at end of file diff --git a/.github/workflows/vsce-publish.yml b/.github/workflows/vsce-publish.yml index c5d1ce9..6f4bf86 100644 --- a/.github/workflows/vsce-publish.yml +++ b/.github/workflows/vsce-publish.yml @@ -10,9 +10,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Install vsce run: npm install -g @vscode/vsce - - name: Install npm + + - name: npm install packages run: npm install + - name: Publish to VSCode Marketplace run: npm run bundle && vsce publish -p ${{ secrets.AZURE_PAT }} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 0bb85bd..6551356 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,10 +20,10 @@ "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "--extensionDevelopmentPath=${workspaceFolder}/../../.vscode/extensions/ismoh-games.second-local-lua-debugger-vscode-0.3.6" + "--extensionDevelopmentPath=${workspaceFolder}/../../.vscode/extensions/ismoh-games.second-local-lua-debugger-vscode-0.3.9" ], "outFiles": [ - "${workspaceFolder}/../../.vscode/extensions/ismoh-games.second-local-lua-debugger-vscode-0.3.6/**/*.js" + "${workspaceFolder}/../../.vscode/extensions/ismoh-games.second-local-lua-debugger-vscode-0.3.9/**/*.js" ], // "preLaunchTask": "npm: watch" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index a229b4d..9f7b57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Version 0.4.0 + +- feat: add GitHub action for easier release creation \ + Refs: [#14](https://github.com/Ismoh/local-lua-debugger-vscode/issues/14) + ## Version 0.3.9 - fix: [#25](https://github.com/Ismoh/local-lua-debugger-vscode/issues/25): Change the error wrapper to pass the original error intact ([#26](https://github.com/Ismoh/local-lua-debugger-vscode/pull/26)) diff --git a/package.json b/package.json index 4de0f45..0a96da2 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "corona" ], "scripts": { - "lint-debugger": "cd debugger && eslint . && cd ..", - "lint-extension": "cd extension && eslint . && cd ..", + "lint-debugger": "cd debugger && eslint . --fix && cd ..", + "lint-extension": "cd extension && eslint . --fix && cd ..", "lint": "npm run lint-debugger && npm run lint-extension", "build-debugger": "tstl -p debugger", "build-extension": "tsc -p extension",