Skip to content

Update CI workflow and main branch references #70

Update CI workflow and main branch references

Update CI workflow and main branch references #70

Workflow file for this run

name: CI
on:
push:
branches:
- main
- features/upgrade
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
name:
- OrchestratorV2
- OrchestratorV3
defaults:
run:
working-directory: tasks/${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore packages
run: npm install
- name: Run lint
run: npm run lint
- name: Run build
run: npm run build
- name: Run tests
run: npm run test
- name: Run clean
run: npm run clean
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: |
tasks/${{ matrix.name }}
!tasks/${{ matrix.name }}/**/*.ts
!tasks/${{ matrix.name }}/tests
!tasks/${{ matrix.name }}/tsconfig.json
!tasks/${{ matrix.name }}/*.config.mjs
!tasks/${{ matrix.name }}/*.svg
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: success() || failure()
with:
files: tasks/${{ matrix.name }}/tests/*.xml
package:
name: Package
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install TFX CLI
run: npm install -g tfx-cli
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extension/tasks
- name: Copy extension
run: |
mkdir -p extension/images && cp images/** extension/images/
mkdir -p extension/docs && cp docs/** extension/docs/
cp LICENSE extension/
cp *.md extension/
cp *.json extension/
- name: Version extension
run: |
pwsh -File scripts/Set-Version.ps1 -Path extension -Patch ${{ github.run_number }}${{ github.run_attempt }}
- name: Set preview
run: |
sed -i 's/"id": "release-orchestrator",/"id": "release-orchestrator-preview",/' extension/vss-extension.json
sed -i 's/"galleryFlags": \[\],/"galleryFlags": \["Preview"\],/' extension/vss-extension.json
sed -i 's/"public": true,/"public": false,/' extension/vss-extension.json
if: ${{ github.ref != 'refs/heads/main' }}
- name: Package extension
run: |
tfx extension create --root extension
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Extension
path: "*.vsix"
release:
name: Release
runs-on: ubuntu-latest
environment:
name: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Preview' }}
needs:
- package
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install TFX CLI
run: npm install -g tfx-cli
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Extension
path: Extension
- name: Validate extension
run: |
extensionPath=$(find Extension -name "*.vsix")
if [ -z "$extensionPath" ]; then
echo "No extension found"
exit 1
fi
if [ "${{ github.ref == 'refs/heads/main' }}" = true ]; then
tfx extension isvalid --vsix $extensionPath --publisher dmitryserbin --extension-id release-orchestrator --token ${{ secrets.MARKETPLACE_TOKEN }}
else
tfx extension isvalid --vsix $extensionPath --publisher dmitryserbin --extension-id release-orchestrator-preview --token ${{ secrets.MARKETPLACE_TOKEN }}
fi
- name: Publish extension
run: |
extensionPath=$(find Extension -name "*.vsix")
if [ -z "$extensionPath" ]; then
echo "No extension found"
exit 1
fi
if [ "${{ github.ref == 'refs/heads/main' }}" = true ]; then
tfx extension publish --vsix $extensionPath --token ${{ secrets.MARKETPLACE_TOKEN }}
else
tfx extension publish --vsix $extensionPath --share-with ${{ secrets.PREVIEW_SHARE_WITH }} --token ${{ secrets.MARKETPLACE_TOKEN }}
fi