Skip to content

chore(main): release 0.1.5 #15

chore(main): release 0.1.5

chore(main): release 0.1.5 #15

Workflow file for this run

name: tag-release
on:
pull_request_target:
types:
- closed
workflow_dispatch:
inputs:
version:
description: Version to tag, without the leading v
required: true
sha:
description: Commit SHA to tag
required: false
pr_number:
description: Release PR number to relabel after tagging
required: false
permissions:
actions: write
contents: write
issues: write
pull-requests: write
jobs:
tag:
if: >
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release-please--'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.sha || github.event.pull_request.merge_commit_sha || github.sha }}
- name: Resolve version
id: version
run: |
if [[ -n "${{ github.event.inputs.version }}" ]]; then
version="${{ github.event.inputs.version }}"
else
version="$(jq -r '."."' .github/.release-please-manifest.json)"
fi
if [[ -z "$version" || "$version" == "null" ]]; then
echo "could not resolve release version" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Create tag if missing
id: create_tag
env:
PUSH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
TARGET_SHA: ${{ github.event.inputs.sha || github.event.pull_request.merge_commit_sha || github.sha }}
run: |
tag="v${{ steps.version.outputs.version }}"
created="false"
git fetch --tags origin
if git rev-parse "$tag" >/dev/null 2>&1; then
echo "tag $tag already exists"
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${PUSH_TOKEN}@github.com/${{ github.repository }}.git"
git tag "$tag" "$TARGET_SHA"
git push origin "$tag"
created="true"
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "created=$created" >> "$GITHUB_OUTPUT"
- name: Dispatch release workflow
if: steps.create_tag.outputs.created == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run release.yml \
--ref main \
-f tag="${{ steps.create_tag.outputs.tag }}"
- name: Mark release PR as tagged
if: github.event_name == 'pull_request_target' || github.event.inputs.pr_number != ''
env:
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
PR_NUMBER: ${{ github.event.inputs.pr_number || github.event.pull_request.number }}
run: |
gh api "repos/${{ github.repository }}/labels" \
-X POST \
-f name='autorelease: tagged' \
-f color='0e8a16' \
-f description='Release PR has been tagged' >/dev/null 2>&1 || true
gh api "repos/${{ github.repository }}/issues/${PR_NUMBER}/labels/autorelease:%20pending" -X DELETE >/dev/null 2>&1 || true
gh issue edit "${PR_NUMBER}" --add-label 'autorelease: tagged'