diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a0d44cea..04450cb63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -398,42 +398,11 @@ jobs: release: name: Create Release - needs: [package, e2e-test] - runs-on: ubuntu-latest - if: ${{ startsWith(github.ref, 'refs/tags/') }} - - steps: - - name: Download VSIX artifact - uses: actions/download-artifact@v4 - with: - name: mta-vsix-artifact-${{ github.run_number }} - path: ./artifacts - - - name: Create GitHub release - run: | - VSIX_FILE=$(find ./artifacts -name "*.vsix" | head -1) - RELEASE_NAME="${{ github.ref_name }}" - - gh release create "${{ github.ref_name }}" \ - --title "MTA Extension $RELEASE_NAME" \ - --notes "Migration Toolkit for Applications extension release $RELEASE_NAME - - ## Installation - Download the .vsix file and install using 'Extensions: Install from VSIX...' in VS Code. - - ## Changes - See the full changelog in the repository." \ - "$VSIX_FILE" - env: - GITHUB_TOKEN: ${{ github.token }} - - # TODO: Add marketplace publishing when ready - # - name: Publish to VS Code Marketplace - # run: npx vsce publish --packagePath "$VSIX_FILE" - # env: - # VSCE_PAT: ${{ secrets.VSCE_PAT }} - - # - name: Publish to Open VSX - # run: npx ovsx publish "$VSIX_FILE" - # env: - # OVSX_PAT: ${{ secrets.OVSX_PAT }} + needs: e2e-test + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + uses: ./.github/workflows/release.yml + with: + tag_name: ${{ github.ref_name }} + prerelease: ${{ contains(github.ref_name, '-') }} + vsix_artifact_name: "vsix-artifact" + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..6891286d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,110 @@ +name: Release + +on: + workflow_call: + inputs: + tag_name: + description: "Tag name for the release" + required: true + type: string + prerelease: + description: "Is this a pre-release?" + required: true + type: boolean + vsix_artifact_name: + description: "Name of the VSIX artifact to download" + required: false + type: string + default: "vsix-artifact" + workflow_run_id: + description: "Workflow run ID to download artifacts from" + required: false + type: string + +env: + HUSKY: 0 + +jobs: + generate_changelog: + name: Generate Changelog + uses: konveyor/release-tools/.github/workflows/generate-changelog.yml@main + with: + version: ${{ inputs.tag_name }} + prev_version: $(gh api repos/${{ github.repository }}/releases/latest | jq -r '.tag_name') + repository: ${{ github.repository }} + ref: ${{ github.sha }} + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Final Release + runs-on: ubuntu-latest + needs: generate_changelog + steps: + - name: Add release details to the step summary + run: | + cat >> "$GITHUB_STEP_SUMMARY" <> "$GITHUB_OUTPUT" + echo "vsix_name=$VSIX_NAME" >> "$GITHUB_OUTPUT" + echo "Found VSIX: $VSIX_NAME at $VSIX_FILE" + + - name: Set up Node.js for publishing + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Publish to VS Code Marketplace + if: ${{ inputs.prerelease == false }} + run: | + echo "Publishing ${{ steps.vsix_info.outputs.vsix_path }}" + if [ -f "./artifacts/release.md" ]; then + echo "Publishing with changelog" + npx @vscode/vsce publish --packagePath "${{ steps.vsix_info.outputs.vsix_path }}" --changelog-path "./artifacts/release.md" + else + echo "Publishing without changelog (file not found)" + npx @vscode/vsce publish --packagePath "${{ steps.vsix_info.outputs.vsix_path }}" + fi + env: + VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + tag: ${{ inputs.tag_name }} + commit: ${{ github.sha }} + bodyFile: ./artifacts/release.md + artifacts: | + ${{ steps.vsix_info.outputs.vsix_path }} + prerelease: ${{ inputs.prerelease }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/mta-build.yaml b/mta-build.yaml index ac2c1a27c..a1a611bc2 100644 --- a/mta-build.yaml +++ b/mta-build.yaml @@ -1,7 +1,7 @@ upstream: repository: konveyor/editor-extensions # Will be updated to specific SHA from release-0.2 branch - ref: 7205d4fed6824e58f6b021c14e6ca3a7c42c3f4a + ref: 780434f0d9727c5acf97d6b88f75ad2ce26ed83a semanticRef: release-0.2 # Maybe useful later