test #150
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: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
pull_request_target: | |
types: | |
- labeled | |
permissions: | |
contents: write | |
checks: write | |
issues: write | |
pull-requests: write | |
jobs: | |
release: | |
if: github.event.action != 'labeled' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Bump version on merging Pull Requests with specific labels. | |
# (bump:major,bump:minor,bump:patch) | |
- id: bumpr | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
uses: haya14busa/action-bumpr@v1 | |
# Get tag name. | |
- id: tag | |
uses: haya14busa/action-cond@v1 | |
with: | |
cond: "${{ startsWith(github.ref, 'refs/tags/') }}" | |
if_true: ${{ github.ref }} | |
if_false: ${{ steps.bumpr.outputs.next_version }} | |
release-check: | |
if: github.event.action == 'labeled' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- id: bumpr | |
name: Post bumpr status comment | |
uses: haya14busa/action-bumpr@v1 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- id: filter | |
uses: dorny/paths-filter@v3 | |
with: | |
filters: | | |
blender: | |
- 'src/XRFeitoriaBpy/*' | |
unreal: | |
- 'src/XRFeitoriaUnreal/*' | |
- name: Determine next version | |
if: ${{ !steps.bumpr.outputs.skip }} | |
run: | | |
# Get the next version from the previous step | |
echo "::group::Get the next version from the previous step" | |
VERSION="${{ steps.bumpr.outputs.next_version }}" | |
echo "Next version: $VERSION" | |
echo "::endgroup::" | |
echo "::group::Git configuration" | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git tag -a "$VERSION" -m "Release $VERSION" | |
echo "::endgroup::" | |
echo "::group::Update plugin info" | |
pip install . | |
if ${{ steps.filter.outputs.blender == 'true' }}; then | |
python -m xrfeitoria.utils.publish_plugins update-bpy-version | |
fi | |
if ${{ steps.filter.outputs.unreal == 'true' }}; then | |
python -m xrfeitoria.utils.publish_plugins update-uplugin-version | |
fi | |
python -m xrfeitoria.utils.publish_plugins update-plugin-info | |
echo "::endgroup::" | |
echo "::group::Set to PR branch/repository" | |
REPO_OWNER=${{ github.event.pull_request.head.repo.owner.login }} | |
REPO_NAME=${{ github.event.pull_request.head.repo.name }} | |
BRANCH_NAME=${{ github.event.pull_request.head.ref }} | |
GIT_URL="github.com/${REPO_OWNER}/${REPO_NAME}.git" | |
echo "Pushing to $GIT_URL" | |
echo "::endgroup::" | |
echo "::group::Commit and push" | |
git add . | |
git commit -m "[bot] Update plugin info" | |
git remote set-url origin https://x-access-token:${{ secrets.ACTIONS_PAT }}@${GIT_URL} | |
git push origin HEAD:${BRANCH_NAME} | |
echo "::endgroup::" | |
# - name: suggester / Leave comments on PRs | |
# if: ${{ !steps.bumpr.outputs.skip }} | |
# uses: reviewdog/action-suggester@v1 |