Skip to content

Commit

Permalink
feat: cd all in one (#1148)
Browse files Browse the repository at this point in the history
* feat: cd all in one

* fix: use empty as default value of cd pipeline

* feat: add sleep before pack visc
  • Loading branch information
LongOddCode committed May 22, 2021
1 parent 19db834 commit 7795495
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 256 deletions.
83 changes: 0 additions & 83 deletions .github/workflows/bump-release.yml

This file was deleted.

116 changes: 116 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: cd

on:
workflow_dispatch:
inputs:
version:
description: 'which version to bump(major, minor, patch, premajor, preminor, prepatch, prerelease)'
required: true
default: 'prerelease'
force:
description: 'force release even if no update(set --force-publish if necessary)'
required: false
default: ''

jobs:
cd:
runs-on: ubuntu-latest

steps:
- name: Checkout dev branch
if: ${{ github.event_name == 'schedule' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.CD_PAT }}
ref: dev

- name: Checkout release branch
if: ${{ github.event_name != 'schedule' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.CD_PAT }}
ref: ${{ github.ref }}

- name: Setup node
uses: actions/[email protected]
with:
node-version: 14

- name: Setup npm registry
run: |
echo "${{ secrets.NPMRC }}" > ~/.npmrc
- name: Download Simple Auth bits
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
retry_on: error
shell: pwsh
command: |
$version=Get-Content packages/fx-core/templates/plugins/resource/simpleauth/version.txt
$tag = "simpleauth@"+$version
$fileName="Microsoft.TeamsFx.SimpleAuth_$version.zip"
$url = "https://github.com/OfficeDev/TeamsFx/releases/download/"+$tag+"/"+$fileName
Invoke-WebRequest $url -OutFile packages/fx-core/templates/plugins/resource/simpleauth/SimpleAuth.zip
- name: Setup project
run: |
npm run setup
- name: Setup git
run: |
git config --global user.name 'MSFT-yiz'
git config --global user.email '[email protected]'
- name: check whether vscode extension changed or not
id: extension-checker
run: |
if npx lerna changed | grep 'ms-teams-vscode-extension';
then
echo "::set-output name=CHANGED::true"
else
echo "::set-output name=CHANGED::false"
fi
- name: release daily npm packages to npmjs.org
if: ${{ github.ref == 'refs/heads/dev' && startsWith(github.event.inputs.version, 'pre') }}
run: |
npx lerna publish --no-private --preid=alpha --dist-tag=alpha ${{ github.event.inputs.version }} --yes ${{ github.event.inputs.force }}
- name: release rc npm packages to npmjs.org
if: ${{ startsWith(github.ref, 'refs/heads/release/') && github.event.inputs.version == 'prerelease' }}
run: |
npx lerna publish --no-private --preid=rc --dist-tag=rc prerelease --yes ${{ github.event.inputs.force }}
- name: release stable npm packages to npmjs.org
if: ${{ startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.event.inputs.version, 'pre') }}
run: |
npx lerna publish --no-private --dist-tag=latest ${{ github.event.inputs.version }} --yes ${{ github.event.inputs.force }}
- name: pack vsix
id: pack-vsix
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
retry_on: error
command: |
sleep 5
cd ./packages/vscode-extension
npm install
npx vsce package
VERSION=`ls *.vsix | awk -F '.vsix' '{print $1}'`
echo "::set-output name=VERSION::$VERSION"
- name: release VSCode extension to github
if: ${{ steps.extension-checker.outputs.CHANGED == 'true' || github.event.inputs.force == '--force-publish' }}
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.CD_PAT }}
prerelease: true
automatic_release_tag: ${{ steps.pack-vsix.outputs.VERSION }}
files: |
./packages/**/*.vsix
75 changes: 0 additions & 75 deletions .github/workflows/daily-release.yml

This file was deleted.

98 changes: 0 additions & 98 deletions .github/workflows/rc-release.yml

This file was deleted.

0 comments on commit 7795495

Please sign in to comment.