diff --git a/.github/workflows/pull-requests-release-manual.yaml b/.github/workflows/pull-requests-release-manual.yaml deleted file mode 100644 index 789a0dcf..00000000 --- a/.github/workflows/pull-requests-release-manual.yaml +++ /dev/null @@ -1,85 +0,0 @@ -name: Manual Release - -on: - workflow_dispatch: - inputs: - tag: - description: 'Release tag (e.g. v0.1.3 or v0.1.3-rc1)' - required: true - type: string - -jobs: - finalize: - name: Finalize Release - runs-on: [self-hosted] - permissions: - contents: write - - if: | - github.event_name == 'workflow_dispatch' && github.ref_name == 'main' - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Create tag on merge commit - run: | - git tag -f ${{ steps.get_tag.outputs.tag }} ${{ github.sha }} - git push -f origin ${{ steps.get_tag.outputs.tag }} - - - name: Ensure maintenance branch release-X.Y - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GH_PAT_TEST }} - script: | - const tag = '${{ inputs.tag }}'; // e.g. v0.1.3 or v0.1.3-rc3 - const match = tag.match(/^v(\d+)\.(\d+)\.\d+(?:[-\w\.]+)?$/); - if (!match) { - core.setFailed(`❌ tag '${tag}' must match 'vX.Y.Z' or 'vX.Y.Z-suffix'`); - return; - } - const line = `${match[1]}.${match[2]}`; - const branch = `release-${line}`; - - // Get main branch commit for the tag - const ref = await github.rest.git.getRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `tags/${tag}` - }); - - const commitSha = ref.data.object.sha; - - try { - await github.rest.repos.getBranch({ - owner: context.repo.owner, - repo: context.repo.repo, - branch - }); - - await github.rest.git.updateRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `heads/${branch}`, - sha: commitSha, - force: true - }); - console.log(`🔁 Force-updated '${branch}' to ${commitSha}`); - } catch (err) { - if (err.status === 404) { - await github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/heads/${branch}`, - sha: commitSha - }); - console.log(`✅ Created branch '${branch}' at ${commitSha}`); - } else { - console.error('Unexpected error --', err); - core.setFailed(`Unexpected error creating/updating branch: ${err.message}`); - throw err; - } - } - diff --git a/.github/workflows/pull-requests-release.yaml b/.github/workflows/pull-requests-release.yaml index b4ca30d0..5614f893 100644 --- a/.github/workflows/pull-requests-release.yaml +++ b/.github/workflows/pull-requests-release.yaml @@ -80,6 +80,7 @@ jobs: - name: Ensure maintenance branch release-X.Y uses: actions/github-script@v7 with: + github-token: ${{ secrets.GH_PAT }} script: | const tag = '${{ steps.get_tag.outputs.tag }}'; // e.g. v0.1.3 or v0.1.3-rc3 const match = tag.match(/^v(\d+)\.(\d+)\.\d+(?:[-\w\.]+)?$/);