release #146
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: | |
workflow_dispatch: | |
branches: [release] | |
inputs: | |
tag: | |
description: "版本号" | |
type: string | |
change: | |
description: "提交内容" | |
type: string | |
pr: | |
description: "需要合并提交" | |
type: string | |
mt: | |
description: "提交到市场" | |
type: string | |
jobs: | |
first: | |
name: version | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: updatepackage | |
if: github.event.inputs.tag != '' | |
run: | | |
sed -i "s/\"version\":.*$/\"version\": \"${{ github.event.inputs.tag }}\",/" package.json | |
- name: change | |
if: github.event.inputs.change != '' | |
run: | | |
echo -e "## version ${{ github.event.inputs.tag }}\n\n- ${{ github.event.inputs.change }}\n\n$(cat CHANGELOG.md)" > CHANGELOG.md | |
- name: commit | |
if: github.event.inputs.tag != '' || github.event.inputs.change != '' | |
run: | | |
git config user.name ccagml | |
git config user.email [email protected] | |
git add . | |
git commit -m ${{ github.event.inputs.change }} | |
git push | |
- name: needpr | |
if: github.event.inputs.pr != '' | |
run: | | |
gh pr create -B main --title 'Merge release${{ github.event.inputs.tag }} into main' --body 'Created by Github action' | |
- name: finish | |
run: | | |
ls | |
market: | |
name: market | |
needs: first | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
if: github.event.inputs.mt != '' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: updatepackage | |
if: github.event.inputs.tag != '' | |
run: | | |
sed -i "s/\"version\":.*$/\"version\": \"${{ github.event.inputs.tag }}\",/" package.json | |
- name: change | |
if: github.event.inputs.change != '' | |
run: | | |
echo -e "## version ${{ github.event.inputs.tag }}\n\n- ${{ github.event.inputs.change }}\n\n$(cat CHANGELOG.md)" > CHANGELOG.md | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Install Node.js modules | |
run: npm install | |
- name: Update Node.js modules | |
run: npm update | |
- name: Install vsce | |
run: npm i -g vsce | |
- name: Publish | |
run: vsce publish -p ${{ secrets.VSCE_PAT }} |