From 341e8d449a0af545e648f167dffe884376d1fdd9 Mon Sep 17 00:00:00 2001 From: Marwan Zaarab Date: Mon, 8 Apr 2024 09:44:55 -0500 Subject: [PATCH] Add release workflow and documentation, and update package.json --- .github/workflows/release.yml | 29 ++++++++++++++-- CONTRIBUTING.md | 17 ---------- RELEASE.md | 62 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 90 insertions(+), 20 deletions(-) create mode 100644 RELEASE.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b0ce28c..0780e8b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,24 +1,49 @@ --- name: Publish VSCode Extension + on: release: types: [created] + jobs: release: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v2 + - name: Install Node.js uses: actions/setup-node@v2 with: node-version: 18.x + cache: 'npm' + - name: Install dependencies - run: npm install - - name: Package VSCode Extension + run: npm ci + + - name: Build Extension run: npm run package + + - name: Package Extension + run: npm run vsce-package + - name: Publish Extension if: success() && startsWith(github.ref, 'refs/tags/') run: npm run deploy env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + + - name: Generate Changelog + if: success() && startsWith(github.ref, 'refs/tags/') + run: | + git log $(git describe --tags --abbrev=0)..HEAD --oneline > CHANGELOG.txt + cat CHANGELOG.txt + + - name: Create GitHub Release + if: success() && startsWith(github.ref, 'refs/tags/') + uses: ncipollo/release-action@v1 + with: + artifacts: 'zenml.vsix' + bodyFile: 'CHANGELOG.txt' + tag: ${{ github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d579104b..60358ad0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,23 +85,6 @@ git push origin feature/your-feature-name 4. **Open a Pull Request**: Go to the original `zenml-io/vscode-zenml` repository and create a pull request from your feature branch. Please follow our [contribution guidelines](https://github.com/zenml-io/zenml/blob/develop/CONTRIBUTING.md) for more details on proposing pull requests. -## Release Process - -The ZenML VSCode extension uses a GitHub Actions workflow defined in `.github/workflows/release.yml` to automate the release process when a new tag is pushed to the repository. - -To create a new release: - -1. Ensure that your changes have been merged into the main branch. -2. Create a new tag following the SemVer format (e.g., `v1.0.0`). -3. Push the tag to the zenml-io/vscode-zenml repository. - -```bash -git tag v1.0.0 -git push origin v1.0.0 -``` - -The `release.yml` workflow will automatically trigger, package the extension, and publish it to the Visual Studio Marketplace. - ## Troubleshooting Common Issues - Ensure all dependencies are up to date and compatible. diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..2ef9af80 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,62 @@ +# Release Process + +This document describes the process of publishing releases for our VS Code extension and provides an explanation of the GitHub Actions workflow file. + +## Overview + +The release process is automated using GitHub Actions. When a new release is created on GitHub, it triggers the release workflow defined in `.github/workflows/release.yml`. The workflow performs the following steps: + +1. Checks out the repository. +2. Installs Node.js and the required dependencies. +3. Builds the extension using webpack. +4. Packages the extension into a `.vsix` file. +5. Publishes the extension to the Visual Studio Code Marketplace. +6. Generates a changelog based on the commit messages. +7. Creates a GitHub release with the packaged extension file as an artifact and the changelog. + +## Prerequisites + +Before creating a release, ensure that: + +- The extension is properly configured and builds successfully. +- The Personal Access Token (PAT) is set as a repository secret named `VSCE_PAT`. + +## Creating a Release + +To create a new release: + +1. Go to the GitHub repository page. +2. Click on the "Releases" tab. +3. Click on the "Draft a new release" button. +4. Enter the tag version for the release (e.g., `v1.0.0`). +5. Set the release title and description. +6. Choose the appropriate release type (e.g., pre-release or stable release). +7. Click on the "Publish release" button. + +Creating the release will trigger the release workflow automatically. + +## Workflow File Explanation + +The release workflow is defined in `.github/workflows/release.yml`. Here's an explanation of each step in the workflow: + +1. **Checkout Repository**: This step checks out the repository using the `actions/checkout@v2` action. + +2. **Install Node.js**: This step sets up Node.js using the `actions/setup-node@v2` action. It specifies the Node.js version and enables caching of npm dependencies. + +3. **Install dependencies**: This step runs `npm ci` to install the project dependencies. + +4. **Build Extension**: This step runs `npm run package` to build the extension using webpack. + +5. **Package Extension**: This step runs `npm run vsce-package` to package the extension into a `.vsix` file named `zenml.vsix`. + +6. **Publish Extension**: This step runs `npm run deploy` to publish the extension to the Visual Studio Code Marketplace. It uses the `VSCE_PAT` secret for authentication. This step only runs if the previous steps succeeded and the workflow was triggered by a new tag push. + +7. **Generate Changelog**: This step generates a changelog by running `git log` to retrieve the commit messages between the latest tag and the current commit. The changelog is saved in a file named `CHANGELOG.txt`. This step only runs if the previous steps succeeded and the workflow was triggered by a new tag push. + +8. **Create GitHub Release**: This step uses the `ncipollo/release-action@v1` action to create a GitHub release. It attaches the `zenml.vsix` file as an artifact, includes the changelog, and sets the release tag based on the pushed tag. This step only runs if the previous steps succeeded and the workflow was triggered by a new tag push. + +## Conclusion + +The provided GitHub Actions workflow automates the publishing of the ZenML VSCode extension. The workflow ensures that the extension is built, packaged, published to the marketplace, and a GitHub release is created with the necessary artifacts and changelog. + +Remember to keep the extension code up to date, maintain the required dependencies, and test the extension thoroughly before creating a release. diff --git a/package.json b/package.json index c9ac6ae7..6079f7ae 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publisher": "ZenML", "displayName": "ZenML Studio", "description": "Integrates ZenML directly into VS Code, enhancing machine learning workflow with support for pipelines, stacks, and server management.", - "version": "0.0.3", + "version": "0.0.4", "icon": "resources/extension-logo.png", "preview": true, "license": "Apache-2.0",