diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05e9bab --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI +on: + - pull_request + - push + +jobs: + test: + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 18.x + - run: npm install + - run: xvfb-run -a npm test + if: runner.os == 'Linux' + - run: npm test + if: runner.os != 'Linux' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ae7e61..fae2faf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,14 @@ on: - # push: - # branches: - # - main workflow_dispatch: + inputs: + releaseType: + required: true + default: 'minor' + type: choice + options: + - major + - minor + - patch jobs: test: @@ -22,8 +28,33 @@ jobs: if: runner.os == 'Linux' - run: npm test if: runner.os != 'Linux' + - name: Package + if: success() && matrix.os == 'ubuntu-latest' + run: | + npm run package ${RELEASE_TYPE} + echo "packageFile=$(ls *.vsix)" >> $GITHUB_ENV + env: + RELEASE_TYPE: ${{ inputs.releaseType }} - name: Publish - if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' - run: npm run deploy + if: success() && matrix.os == 'ubuntu-latest' + run: | + npm run publish -i ${VSIX_PATH} env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + VSIX_PATH: ${{ env.packageFile }} + - name: Push tag + if: success() && matrix.os == 'ubuntu-latest' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git push --tags + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v2 + if: success() && matrix.os == 'ubuntu-latest' + with: + files: | + ${{ env.packageFile }} \ No newline at end of file diff --git a/LICENSE b/LICENSE index e470d92..112c35b 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/package.json b/package.json index c886662..a280835 100644 --- a/package.json +++ b/package.json @@ -199,7 +199,8 @@ "pretest": "npm run compile && npm run lint", "lint": "eslint src --ext ts", "test": "vscode-test", - "deploy": "vsce publish" + "package": "vsce package", + "publish": "vsce publish" }, "devDependencies": { "@types/mocha": "^10.0.6", diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..8a885db --- /dev/null +++ b/test.txt @@ -0,0 +1,37 @@ +Executing prepublish script 'npm run vscode:prepublish'... + +> projects-browser@0.1.0 vscode:prepublish +> npm run compile + + +> projects-browser@0.1.0 compile +> tsc -p ./ + + INFO Files included in the VSIX: +projects-browser-0.1.0.vsix +├─ [Content_Types].xml +├─ extension.vsixmanifest +└─ extension/ + ├─ CHANGELOG.md [0.24 KB] + ├─ LICENSE.txt + ├─ README.md [2.54 KB] + ├─ package.json [5.97 KB] + ├─ test.txt [0.17 KB] + ├─ .github/ + │ └─ workflows/ + │ ├─ ci.yml [0.46 KB] + │ └─ release.yml [0.86 KB] + ├─ images/ + │ └─ icon.png [22.82 KB] + └─ out/ + ├─ common.js [2.67 KB] + ├─ extension.js [4.87 KB] + ├─ filterview.js [1.89 KB] + ├─ interfaces.js [0.11 KB] + ├─ projectsfavoritesprovider.js [2.17 KB] + ├─ projectsprovider.js [2.91 KB] + ├─ utils.js [4.52 KB] + └─ test/ + └─ extension.test.js [1.61 KB] + + DONE Packaged: /home/matteo/coding/projects-browser/projects-browser-0.1.0.vsix (18 files, 21.02 KB)