Merge pull request #4 from ofspectrum/sync-sdk-v1.1.5 #2
This file contains hidden or 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
| # Create a release tag after SDK changes land on main. | |
| name: Tag SDK Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'pyproject.toml' | |
| workflow_dispatch: | |
| permissions: | |
| actions: write | |
| contents: write | |
| jobs: | |
| tag-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Read SDK version | |
| id: version | |
| run: | | |
| VERSION=$(python - <<'PY' | |
| import tomllib | |
| with open("pyproject.toml", "rb") as f: | |
| print(tomllib.load(f)["project"]["version"]) | |
| PY | |
| ) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Create release tag and dispatch publish | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| TAG="v$VERSION" | |
| git fetch --tags | |
| if git rev-parse "refs/tags/$TAG" >/dev/null 2>&1; then | |
| echo "Tag $TAG already exists, skipping" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| # Tags pushed with GITHUB_TOKEN do not trigger push workflows, so | |
| # dispatch the existing publish workflow explicitly at the new tag. | |
| gh workflow run publish.yml --ref "$TAG" |