deploy target branch #1
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: deploy target branch | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "The version of the release" | |
required: true | |
release-title: | |
description: "The title of the release" | |
required: true | |
release-content: | |
description: "The summary of the release, a.k.a release note" | |
required: true | |
target-branch: | |
description: "The target branch to deploy" | |
default: "master" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to branch master | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.target-branch }} | |
- name: Setup python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install build tool | |
run: pip install build | |
- name: Build | |
id: build | |
run: python -m build | |
- name: Get build results | |
id: build-result | |
run: | | |
echo "whl=$(ls dist/ | grep whl)" >> $GITHUB_OUTPUT | |
echo "tar=$(ls dist/ | grep tar)" >> $GITHUB_OUTPUT | |
- name: Create release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ inputs.release-title }} | |
tag_name: ${{ format('v{0}', inputs.version) }} | |
body: ${{ inputs.release-content }} | |
prerelease: false | |
draft: false | |
files: | | |
${{ format('dist/{0}', steps.build-result.outputs.whl) }} | |
${{ format('dist/{0}', steps.build-result.outputs.tar) }} | |
- name: Trigger action in index repository | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.PYPI_ACTION_DISPATCH }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
${{ secrets.PYPI_ACTION_URL }} \ | |
-d '{"ref":"master"}' | |
- name: Trigger action in owlite-doc repository | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
${{ secrets.DOC_ACTION_URL }} \ | |
-d '{"ref":"main","inputs":{"source":"${{ inputs.target-branch }}","target":"main","msg":"${{ inputs.release-title }} [${{ format('v{0}', inputs.version) }}]"}}' |