Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Outputs and tags are not getting generated through .yml #2465

Open
preet248 opened this issue Jan 9, 2025 · 0 comments
Open

Release Outputs and tags are not getting generated through .yml #2465

preet248 opened this issue Jan 9, 2025 · 0 comments
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@preet248
Copy link

preet248 commented Jan 9, 2025

Release Outputs and tags are not getting generated through .yml. But release and tags are getting created on rerunning the yml again. I am using .yml to create changeling on creating any branch name contains "Release"
changelog.yml

name: Release Please

on:
push:
branches:

  • '[rR][eE][lL][eE][aA][sS][eE]'

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.release.outputs.tag_name}}
release_created: ${{ steps.release.outputs.release_created}}
steps:

  • uses: actions/checkout@v4

    • name: Set up Node.js
      uses: actions/setup-node@v3
      with:
      node-version: '20.16.0'

    • name: Install jq
      run: sudo apt-get install jq

    • name: Extract npm version from package.json
      id: extract-npm-version
      run: echo "NPM_VERSION=$(jq -r '.engines.npm' package.json)" >> $GITHUB_ENV

    • name: Install specific npm version
      run: npm install -g npm@${{ env.NPM_VERSION }}

    • name: Run Release Please
      uses: googleapis/release-please-action@v4
      id: release
      with:
      token: ${{ secrets.GITHUB_TOKEN }}
      config-file: release-please-config.json
      manifest-file: .release-please-manifest.json
      target-branch: ${{ github.ref_name }}

    • name: Tag major and minor versions
      if: ${{ steps.release.outputs.release_created }}
      continue-on-error: true
      run: |
      git config user.name github-actions[bot]
      git config user.email 41898282+github-actions[bot]@users.noreply.github.com
      git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/googleapis/release-please-action.git"
      git tag -d v${{ steps.release.outputs.major }} || true
      git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
      git push origin :v${{ steps.release.outputs.major }} || true
      git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
      git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
      git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
      git push origin v${{ steps.release.outputs.major }}
      git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}

    • name: Debug Release Outputs
      run: |
      echo "release_created: ${{ steps.release.outputs.release_created }}"
      echo "tag_name: ${{ steps.release.outputs.tag_name }}"

    • name: Print release outputs for debugging
      continue-on-error: true
      run: |
      echo "Release created: ${{ steps.release.outputs['release_created'] }}"
      echo "Tag name: ${{ steps.release.outputs['tag_name'] }}"
      echo "Release outputs:"
      echo "${{ steps.release.outputs }}"
      echo "${{ toJson(steps.release.outputs) }}"

    • name: Create CHANGELOG.md
      env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
      if [[ -f CHANGELOG.md ]]; then
      echo "Appending changelog..."
      else
      echo "Creating changelog..."
      echo "# Changelog" > CHANGELOG.md
      fi
      gh release view --json body --jq .body | tee -a CHANGELOG.md

    • name: Delete Git Tags
      if: success()
      run: |
      git fetch --tags
      TAGS=$(git tag)
      for TAG in $TAGS; do
      echo "Deleting tag $TAG"
      git tag -d $TAG
      git push origin :refs/tags/$TAG
      done

    • name: Auto-Merge Release PR
      env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
      PR_NUMBER=$(gh pr list --state open --json number --jq '.[0].number')

      echo "PR Number: $PR_NUMBER"
      gh pr merge $PR_NUMBER --merge
      

.release-please-manifest.json

{
".": "1.6.0"
}

release-please-config.json
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"tag-separator": "@",
"separate-pull-requests": true,
"packages": {
".": {
"package-name": "changelog25",
"release-type": "node"
}
}
}

I am trying to do this workaround

"A workaround seems to be to add the release-please:force-run label to the merged PR, as suggested in the README"

I tried adding label after - name: Run Release Please, but still tags and releases are not getting created.

  • name: Install GitHub CLI
    run: |
    sudo apt-get update
    sudo apt-get install -y gh

  • name: Authenticate GitHub CLI
    run: |
    echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token

  • name: Add release-please:force-run Label
    env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: |

    Retrieve the PR created by release-please

    PR_NUMBER=$(gh pr list --state open --head ${{ github.ref_name }} --json number --jq '.[0].number')
    echo "PR Number: $PR_NUMBER"

    Add the label to the PR

    if [ -n "$PR_NUMBER" ]; then
    gh pr edit $PR_NUMBER --add-label "release-please:force-run"
    else
    echo "No PR found for the current branch."
    fi
    Output:
    1st Run of .yml when branch name consists "Release.."(i.e, release-9.0) is created:
    (here release outputs are not created and hence tags are not generated based on condition applied)
    Run googleapis/release-please-action@v4
    with:
    token: ***
    config-file: release-please-config.json
    manifest-file: .release-please-manifest.json
    target-branch: release-9.0
    repo-url: UKGEPIC/changelog25
    github-api-url: https://api.github.com/
    github-graphql-url: https://api.github.com/graphql
    fork: false
    include-component-in-tag: false
    skip-github-release: false
    skip-github-pull-request: false
    changelog-host: https://github.com/
    env:
    NPM_VERSION: 10.8.3
    Running release-please version: 16.12.0
    ❯ Fetching release-please-config.json from branch release-9.0
    ❯ Fetching .release-please-manifest.json from branch release-9.0
    ✔ Building releases
    ✔ Building strategies by path
    ❯ .: node
    ❯ Fetching release-please-config.json from branch release-9.0
    ❯ Fetching .release-please-manifest.json from branch release-9.0
    ✔ Building pull requests
    ✔ Building strategies by path
    ❯ .: node
    ✔ Collecting release commit SHAs
    ❯ release search depth: 400
    ❯ Fetching releases with cursor undefined
    ⚠ Expected 1 releases, only found 0
    ⚠ Missing 1 paths: .
    ❯ looking for tagName: changelog25@v1.6.0
    ⚠ Expected 1 releases, only found 0
    ✔ Collecting commits since all latest releases
    ❯ commit search depth: 500
    ❯ Set(0) {}
    ❯ Fetching merge commits on branch release-9.0 with cursor: undefined
    ❯ Backfilling file list for commit: 59331fef3f1bab3bfc73e7181787ad920f646a69
    ❯ Found 1 files
    ❯ Backfilling file list for commit: 5b528dfca0b5806b784e12774b2408ef825b89aa
    ❯ Found 1 files
    ❯ Backfilling file list for commit: 3bb98ba3e0f10f3c79a97e77bf19176184ab4a0d
    ❯ Found 5 files
    ❯ Backfilling file list for commit: 1fba616431f4080026bff9179f57c9c36ce87395
    ❯ Found 5 files
    ❯ Backfilling file list for commit: acf208e263d2981930bf3915850ba8570dcc008e
    ❯ Found 1 files
    ❯ Backfilling file list for commit: a56af1848fc5159a8bff225d5c002853f287cb38
    ❯ Found 1 files
    ❯ Backfilling file list for commit: c6bd84a4cb64fccb31ba66519d098d92bfc14574
    ❯ Found 4 files
    ❯ Backfilling file list for commit: 489d06fbf0578119aaac54afe9f64b492add7c52
    ❯ Found 4 files
    ❯ Backfilling file list for commit: 2620ce9b57c26b3d9d37b9ba8513fa3c9107095a
    ❯ Found 1 files
    ❯ Backfilling file list for commit: 362c45159b31261a891344c508f4e116ee8d8e10
    ❯ Found 1 files
    ❯ Backfilling file list for commit: e10967ea4e0728634947040aa3f09e83478b4540
    ❯ Found 1 files
    ❯ Backfilling file list for commit: d5ab46a1d48781731596ee55b693299d2cd93681
    ❯ Found 154 files
    ✔ Splitting 19 commits by path
    ✔ No latest release found for path: ., component: changelog25, but a previous version (1.6.0) was specified in the manifest.
    ✔ Building candidate release pull request for path: .
    ❯ type: node
    ❯ targetBranch: release-9.0
    ❯ commit could not be parsed: 30ec3fb19e8f3f030d81cf91c2c4e4a65baa5398 Merge pull request chore: release 1.0.0 #42 from UKGEPIC/develop
    ❯ commit could not be parsed: 59331fef3f1bab3bfc73e7181787ad920f646a69 Merge pull request chore: release 1.0.0 #41 from UKGEPIC/12th
    ❯ commit could not be parsed: 3bb98ba3e0f10f3c79a97e77bf19176184ab4a0d Merge pull request chore: release 1.0.0 #35 from UKGEPIC/develop
    ❯ commit could not be parsed: 79ce3022d246489741a9119d607650935a895261 Develop (build: switching to running workflow when new comment is created #28)
    ❯ commit could not be parsed: 4d6d9846bf7c83e6559e3634a0a08e72f1b16da2 Develop (fix: could not handle the very first release of a library before it had any tags. #24)
    ❯ commit could not be parsed: acf208e263d2981930bf3915850ba8570dcc008e Merge pull request build: patch Windows container, fixing Node 10 #18 from UKGEPIC/develop
    ❯ commit could not be parsed: c6bd84a4cb64fccb31ba66519d098d92bfc14574 Merge pull request [DO NOT LAND] chore: debugging platform specific coverage issues #16 from UKGEPIC/develop
    ❯ commit could not be parsed: 2620ce9b57c26b3d9d37b9ba8513fa3c9107095a Merge pull request chore: do not run CI on grpc-js #13 from UKGEPIC/develop
    ⚠ No latest release pull request found.
    ❯ commit could not be parsed: 3c0174dd83792adb831a6da932700403c3e85a65 Develop (build!: upgrade engines field to >=8.10.0 #9)
    ❯ commit could not be parsed: 1748444427dbc43a71f352ad588ae173b615094b Develop (docs: fixed typo in README #8)
    ❯ commit could not be parsed: 6bd774cae891b90f647b2d3767e6ad0759079bac Develop (fix: support H2 and H3 CHANGELOG headings #6)
    ❯ commit could not be parsed: e10967ea4e0728634947040aa3f09e83478b4540 Update CODEOWNERS file
    ❯ commit could not be parsed: d5ab46a1d48781731596ee55b693299d2cd93681 initial commit
    ❯ commits: 8
    ✔ Considering: 8 commits
    ❯ component: changelog25
    ❯ pull request title pattern: undefined
    ✔ Looking for open release pull requests
    ✔ found 0 open release pull requests.
    ✔ Looking for snoozed release pull requests
    ✔ found 0 snoozed release pull requests.
    ❯ Fetching package-lock.json from branch release-9.0
    ✔ updating from 1.6.0 to 1.7.0
    ❯ Fetching npm-shrinkwrap.json from branch release-9.0
    ⚠ file npm-shrinkwrap.json did not exist
    ⚠ file samples/package.json did not exist
    ❯ Fetching samples/package.json from branch release-9.0
    ❯ Fetching CHANGELOG.md from branch release-9.0
    ❯ Fetching package.json from branch release-9.0
    ✔ updating from 1.6.0 to 1.7.0
    ❯ Fetching changelog.json from branch release-9.0
    ⚠ file changelog.json did not exist
    ❯ Fetching .release-please-manifest.json from branch release-9.0
    ✔ Starting GitHub PR workflow...
    ✔ Successfully found branch HEAD sha "30ec3fb19e8f3f030d81cf91c2c4e4a65baa5398".
    ✔ Successfully created branch at [https://api.github.com//repos/UKGEPIC/changelog25/git/refs/heads/release-please--branches--release-9.0--components--changelog25](https://api.github.com//repos/UKGEPIC/changelog25/git/refs/heads/release-please--branches--release-%5B9%5D(https://github.com/UKGEPIC/changelog25/actions/runs/12666031427/job/35296668582#step:7:9).0--components--changelog25)
    ✔ Got the latest commit tree
    ✔ Successfully created a tree with the desired changes with SHA 0f7dbc3c81ffca7158a82fadde0df77390bac75d
    ✔ Successfully created commit. See commit at [https://api.github.com/repos/UKGEPIC/changelog25/git/commits/14c31b0f3a7689902035ad4e0b3847400ff72a68](https://api.github.com/repos/UKGEPIC/changelog25/git/commits/%5B14%5D(https://github.com/UKGEPIC/changelog25/actions/runs/12666031427/job/35296668582#step:7:14)c31b0f3a7689902035ad4e0b3847400ff72a68)
    ✔ Updating reference heads/release-please--branches--release-9.0--components--changelog25 to 14c31b0f3a7689902035ad4e0b3847400ff72a68
    ✔ Successfully updated reference release-please--branches--release-9.0--components--changelog25 to 14c31b0f3a7689902035ad4e0b3847400ff72a68
    ✔ Successfully opened pull request available at url: https://api.github.com/repos/UKGEPIC/changelog25/pulls/43.
    ✔ Successfully opened pull request: 43.
    ✔ Successfully added labels autorelease: pending to issue: 43
    7s

2nd Run of .yml when pushed on same "Release.." (i.e, release-9.0):
(here release outputs are created and hence tags are generated in next step where firstly "pending" tag removed and "tagged" tag is added after creating PR )(highlighted the steps)
Run googleapis/release-please-action@v4
with:
token: ***
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
target-branch: release-9.0
repo-url: UKGEPIC/changelog25
github-api-url: https://api.github.com/
github-graphql-url: https://api.github.com/graphql
fork: false
include-component-in-tag: false
skip-github-release: false
skip-github-pull-request: false
changelog-host: https://github.com/
env:
NPM_VERSION: 10.8.3
Running release-please version: 16.12.0
❯ Fetching release-please-config.json from branch release-9.0
❯ Fetching .release-please-manifest.json from branch release-9.0
✔ Building releases
✔ Building strategies by path
❯ .: node
❯ Found pull request #43: 'chore(release-9.0): release changelog25 1.7.0'
✔ Building release for path: .
❯ type: node
❯ targetBranch: release-9.0
✔ Creating 1 releases for pull #43
❯ adding comment to https://github.com/UKGEPIC/changelog25/issues/43
❯ removing labels: autorelease: pending from issue/pull 43
❯ adding labels: autorelease: tagged from issue/pull 43
❯ Fetching release-please-config.json from branch release-9.0
❯ Fetching .release-please-manifest.json from branch release-9.0
✔ Building pull requests
✔ Building strategies by path
❯ .: node
✔ Collecting release commit SHAs
❯ release search depth: 400
❯ Fetching releases with cursor undefined
❯ Found release for path ., [email protected]
❯ release for path: ., version: 1.7.0, sha: 337a5463cd7f1ff7b6946cab684ac9eb1efd2381
✔ Collecting commits since all latest releases
❯ commit search depth: 500
❯ Set(1) { '337a5463cd7f1ff7b6946cab684ac9eb1efd2381' }
❯ Fetching merge commits on branch release-9.0 with cursor: undefined
❯ Backfilling file list for commit: cb0be4df9f28a1e517f59eba80336cbff1476720
❯ Found 1 files
❯ Backfilling file list for commit: 337a5463cd7f1ff7b6946cab684ac9eb1efd2381
❯ Found 4 files
❯ Backfilling file list for commit: 14c31b0f3a7689902035ad4e0b3847400ff72a68
❯ Found 4 files
❯ Backfilling file list for commit: 59331fef3f1bab3bfc73e7181787ad920f646a69
❯ Found 1 files
❯ Backfilling file list for commit: 5b528dfca0b5806b784e12774b2408ef825b89aa
❯ Found 1 files
❯ Backfilling file list for commit: 3bb98ba3e0f10f3c79a97e77bf19176184ab4a0d
❯ Found 5 files
❯ Backfilling file list for commit: 1fba616431f4080026bff9179f57c9c36ce87395
❯ Found 5 files
❯ Backfilling file list for commit: acf208e263d2981930bf3915850ba8570dcc008e
❯ Found 1 files
❯ Backfilling file list for commit: a56af1848fc5159a8bff225d5c002853f287cb38
❯ Found 1 files
❯ Backfilling file list for commit: c6bd84a4cb64fccb31ba66519d098d92bfc14574
❯ Found 4 files
❯ Backfilling file list for commit: 489d06fbf0578119aaac54afe9f64b492add7c52
❯ Found 4 files
❯ Backfilling file list for commit: 2620ce9b57c26b3d9d37b9ba8513fa3c9107095a
❯ Found 1 files
❯ Backfilling file list for commit: 362c45159b31261a891344c508f4e116ee8d8e10
❯ Found 1 files
❯ Backfilling file list for commit: e10967ea4e0728634947040aa3f09e83478b4540
❯ Found 1 files
❯ Backfilling file list for commit: d5ab46a1d48781731596ee55b693299d2cd93681
❯ Found 154 files
✔ Splitting 1 commits by path
✔ Building candidate release pull request for path: .
❯ type: node
❯ targetBranch: release-9.0
❯ commits: 1
✔ Considering: 1 commits
❯ component: changelog25
❯ pull request title pattern: undefined
✔ Looking for open release pull requests
✔ found 0 open release pull requests.
✔ Looking for snoozed release pull requests
✔ found 0 snoozed release pull requests.
❯ Fetching package-lock.json from branch release-9.0
✔ updating from 1.7.0 to 1.8.0
❯ Fetching npm-shrinkwrap.json from branch release-9.0
⚠ file npm-shrinkwrap.json did not exist
❯ Fetching samples/package.json from branch release-9.0
⚠ file samples/package.json did not exist
❯ Fetching CHANGELOG.md from branch release-9.0
❯ Fetching package.json from branch release-9.0
✔ updating from 1.7.0 to 1.8.0
❯ Fetching changelog.json from branch release-9.0
⚠ file changelog.json did not exist
❯ Fetching .release-please-manifest.json from branch release-9.0
✔ Starting GitHub PR workflow...
✔ Successfully found branch HEAD sha "cb0be4df9f28a1e517f59eba80336cbff1476720".
✔ Skipping branch creation step...
✔ Got the latest commit tree
✔ Successfully created a tree with the desired changes with SHA a7b249555c699666907dd531a9f90137a53d7772
✔ Successfully created commit. See commit at [https://api.github.com//repos/UKGEPIC/changelog25/git/commits/eae8d79307bae3b165fca6031b8e0980d2a104c2](https://api.github.com//repos/UKGEPIC/changelog25/git/commits/eae8d7%5B9%5D(https://github.com/UKGEPIC/changelog25/actions/runs/12666085906/job/35296809595#step:7:9)307bae3b165fca6031b8e0980d2a%5B10%5D(https://github.com/UKGEPIC/changelog25/actions/runs/12666085906/job/35296809595#step:7:10)4c2)
✔ Updating reference heads/release-please--branches--release-9.0--components--changelog25 to eae8d79307bae3b165fca6031b8e0980d2a104c2
✔ Successfully updated reference release-please--branches--release-9.0--components--changelog25 to eae8d79307bae3b165fca6031b8e0980d2a104c2
✔ Successfully opened pull request available at url: https://api.github.com/repos/UKGEPIC/changelog25/pulls/44.
✔ Successfully opened pull request: 44.
✔ Successfully added labels autorelease: pending to issue: 44

Added more detail text comparison of 1st and 2nd run:
https://mail.google.com/mail/u/0/?ui=2&ik=a309faa6ed&view=lg&permmsgid=msg-f:1820677554407082975&ser=

@preet248 preet248 added priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants