Release #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: "Enter Tag for the release" | |
required: true | |
prerelease: | |
description: "Is this a pre-release?" | |
required: true | |
type: boolean | |
default: false | |
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker | |
env: | |
HUSKY: 0 | |
jobs: | |
release_prereq: | |
name: Build, Test, and Package (${{ matrix.arch }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: linux | |
- os: macos-latest | |
arch: macos | |
- os: windows-latest | |
arch: windows | |
max-parallel: 3 | |
outputs: | |
tag_name: ${{ steps.determine_tag.outputs.tag_name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Determine the tag | |
id: determine_tag | |
run: | | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
echo "tag_name=${{ inputs.tag_name }}" >> $GITHUB_OUTPUT | |
else | |
echo "tag_name=${{ github.ref }}" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Install dependencies | |
run: npm ci | |
# Run tests on different OSes | |
- name: Run tests (Linux) | |
if: matrix.arch == 'linux' | |
run: xvfb-run -a npm run test | |
- name: Run tests (macOS) | |
if: matrix.arch == 'macos' | |
run: npm test | |
- name: Run tests (Windows) | |
if: matrix.arch == 'windows' | |
shell: cmd | |
run: npm test | |
# clean | |
- name: Clean build | |
run: | | |
npm run clean | |
npm run build | |
# Collect assets | |
- name: Collect assets | |
run: npm run collect-assets | |
# Copy files to dist folder | |
- name: Copy files to dist folder | |
run: npm run dist | |
# Build VSIX package | |
- name: Build VSIX package | |
run: npm run package | |
# Upload VSIX artifact (linux ) | |
- name: Upload VSIX artifact | |
if: matrix.arch == 'linux' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vscode-extension-${{ matrix.arch }} | |
path: ./dist/*.vsix | |
generate_changelog: | |
name: Generate Changelog | |
needs: release_prereq | |
uses: konveyor/release-tools/.github/workflows/generate-changelog.yml@main | |
with: | |
version: ${{ needs.release_prereq.outputs.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: [release_prereq, generate_changelog] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download Changelog Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: changelog-artifact | |
path: ./artifacts | |
- name: List available artifacts | |
run: | | |
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts | |
- name: Download Linux Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: vscode-extension-linux | |
path: ./artifacts/vscode-extension-linux | |
- name: Verify Downloaded Artifacts | |
run: ls -R ./artifacts | |
- name: Rename VSIX Packages | |
run: | | |
mv ./artifacts/vscode-extension-linux/*.vsix ./artifacts/konveyor-${{ needs.release_prereq.outputs.tag_name }}.vsix | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ needs.release_prereq.outputs.tag_name }} | |
commit: ${{ github.sha }} | |
bodyFile: ./artifacts/release.md | |
artifacts: | | |
./artifacts/konveyor-*.vsix | |
prerelease: ${{ github.event.inputs.prerelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |