Skip to content

Release

Release #35

Workflow file for this run

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
dry-run:
description: "Should this be a dry run of the release?"
required: false
type: boolean
default: false
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
env:
HUSKY: 0
jobs:
test_the_release:
name: Test the release (${{ matrix.platform }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: macos
- os: windows-latest
platform: 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_name }}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Install dependencies, download runtime assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
npm run collect-assets -- --use-release
# Run tests on different OSes
- name: Run tests (Linux)
if: matrix.platform == 'linux'
run: xvfb-run -a npm run test
- name: Run tests (macOS)
if: matrix.platform == 'macos'
run: npm test
- name: Run tests (Windows)
if: matrix.platform == 'windows'
shell: cmd
run: npm test
package:
needs: test_the_release
name: Generate the vsix for the release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Build the project and generate the .vsix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
npm run build
npm run collect-assets -- --use-release
npm run dist
npm run package
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: vscode-extension-${{ matrix.platform }}
path: ./dist/*.vsix
generate_changelog:
name: Generate Changelog
needs: test_the_release
uses: konveyor/release-tools/.github/workflows/generate-changelog.yml@main
with:
version: ${{ needs.test_the_release.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: [test_the_release, package, generate_changelog]
steps:
- name: Add release details to the step summary
run: |
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
## Release Information
Tag: __${{ needs.test_the_release.outputs.tag_name }}__
Pre-Release: __${{ github.event.inputs.prerelease }}__
Dry run? __${{ github.event.inputs.dry-run}}__
EOF
- 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.test_the_release.outputs.tag_name }}.vsix
- name: Create Release
if: ${{ github.event.inputs.dry-run == 'false' }}
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.test_the_release.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 }}