Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
wenytang-ms committed Jun 2, 2023
1 parent c96c8a5 commit 215be45
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions .github/workflows/cd_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@ name: TeamsFx-CD Triggers

on:
workflow_run:
workflows: ["CD"]
branches: ["main", "dev", "hotfix/**", "prerelease"]
workflows: ["CD", "vscode-marketplace"]
branches: ["main", "dev", "ga", "hotfix/**", "dd/main"]
types: ["completed"]

jobs:
TeamsFxCICDTestTriggers:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && !startsWith(github.event.workflow_run.head_branch, 'hotfix') }}
if: ${{ github.event.workflow_run.conclusion == 'success' && !startsWith(github.event.workflow_run.head_branch, 'hotfix') && github.event.workflow_run.workflows == "CD" }}
steps:
- name: Trigger TeamsFx-CICD-Test
run: |
curl \
-u :${{ secrets.GHEC_BOT_PAT }} \
-u :${{ secrets.TEAMSFX_BOT }} \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/devdiv-azure-service-dmitryr/TeamsFx-CICD-Test/actions/workflows/trigger_cicd_by_${{ github.event.workflow_run.head_branch }}.yml/dispatches \
https://api.github.com/repos/OfficeDev/TeamsFx-CICD-Test/actions/workflows/trigger_cicd_by_${{ github.event.workflow_run.head_branch }}.yml/dispatches \
-d "{\"ref\":\"main\"}"
DownloadAndOutput:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.workflows == "CD" }}
outputs:
zipLink: ${{ steps.downloadUrl.outputs.result }}
pre_id: ${{ steps.preid.outputs.result }}
server_version: ${{ steps.version.outputs.result }}
steps:
- name: Download artifact
id: downloadUrl
uses: actions/github-script@v6
with:
script: |
Expand All @@ -49,7 +47,6 @@ jobs:
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/release.zip`, Buffer.from(download.data));
return matchArtifact.url
- name: Unzip artifact
run: unzip release.zip
Expand Down Expand Up @@ -84,6 +81,7 @@ jobs:
CallAzurePipeline:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.workflows == "CD" }}
needs: DownloadAndOutput
steps:
- name: Call Azure Pipeline
Expand All @@ -93,30 +91,23 @@ jobs:
azure-devops-project-url: https://devdiv.visualstudio.com/InternalTools
azure-pipeline-name: TeamsFx-Dev17-CD
azure-devops-token: ${{ secrets.VS_ADO_PAT }}
azure-pipeline-variables: '{"PreId": ${{needs.downloadAndOutput.outputs.pre_id}}, "ServerVersion": ${{needs.downloadAndOutput.outputs.server_version}}, "zipLink": ${{needs.downloadAndOutput.outputs.zipLink}}}'
azure-pipeline-variables: '{"PreId": ${{needs.downloadAndOutput.outputs.pre_id}}, "ServerVersion": ${{needs.downloadAndOutput.outputs.server_version}}}'

CheckSetupSuccess:
pushRemoteTag:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.workflows == 'vscode-marketplace' }}
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
token: ${{ secrets.CD_PAT }}
ref: ${{ github.event.workflow_run.head_branch }}

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14
- name: Setup project
id: setup
run: npm run setup
continue-on-error: true
- name: Info
if: steps.setup.outcome != 'success'
- name: get vsc version
id: vsc_ver
run: |
echo "`npm run setup` failed after current project finish CD,\
it may be the inconsistency of package dependencies caused by separate release,\
please confirm this problem will not affect the CI of subsequent PRs."
VSC_VER=$(npx lerna ls --json -all|jq -c -r '.[]|select(.name == "ms-teams-vscode-extension")|.name+"-"+.version')
echo "::set-output name=vsc_ver::$VSC_VER"
- uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.CD_PAT }}
custom_tag: ${{ steps.vsc_ver.outputs.vsc_ver }}

0 comments on commit 215be45

Please sign in to comment.