JS Release #43
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: JS Release | |
on: | |
workflow_dispatch: | |
jobs: | |
build-and-publish: | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: "https://registry.npmjs.org" | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install Poetry | |
run: | | |
pip install poetry | |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
cd python && poetry lock --no-update | |
- name: Setup Python Cache | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: "poetry" | |
- name: Install Rollup globally | |
run: npm install --global rollup | |
- name: Clear npm cache | |
run: npm cache clean --force | |
- name: Install dependencies | |
working-directory: ./javascript | |
run: | | |
yarn install --frozen-lockfile | |
cd ../ && make install | |
- name: Run mock | |
run: | |
make mock | |
# - name: Run test | |
# working-directory: ./javascript | |
# run: | |
# yarn test | |
- name: Build package with Rollup | |
working-directory: ./javascript | |
run: npx rollup -c rollup.config.mjs | |
- name: Get version | |
working-directory: ./javascript | |
id: get_version | |
run: | | |
VERSION=$(node -e "console.log(require('./package.json').version);") | |
echo $VERSION | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Publish package | |
working-directory: ./javascript | |
run: npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: get pr collection # 获取tag之间的pr内容,输出为md文件的路径 | |
id: get-pr | |
working-directory: ./python | |
env: | |
REPO: ${{ github.repository }} | |
QF_GITHUB_TOKEN: ${{ secrets.QF_GITHUB_TOKEN }} | |
NEW_TAG: ${{ format('js/v{0}', steps.get_version.outputs.version) }} | |
run: | | |
bash ./scripts/release_note.sh js | |
echo body_path=$(realpath ./release_note.md) >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ format('JavaScript v{0}', steps.get_version.outputs.version) }} | |
token: ${{ secrets.QF_GITHUB_TOKEN }} | |
draft: false | |
bodyFile: ${{ steps.get-pr.outputs.body_path }} # 引入上文生成的release_note.md作为内容 | |
generateReleaseNotes: false | |
tag: ${{ format('js/v{0}', steps.get_version.outputs.version) }} | |
prerelease: ${{ contains(steps.get_version.outputs.version, 'rc') }} | |
commit: main |