File: release-branch.yml

package info (click to toggle)
node-yarnpkg 4.1.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,828 kB
  • sloc: javascript: 38,953; ansic: 26,035; cpp: 7,247; sh: 2,829; makefile: 724; perl: 493
file content (86 lines) | stat: -rw-r--r-- 2,818 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
on:
  workflow_dispatch:
    inputs:
      branch:
        description: 'Branch?'
        required: true
        default: 'cherry-pick/'

env:
  node-version: '18.x'

name: 'Release Branch'
jobs:
  release:
    name: 'Release a new stable version'
    runs-on: ubuntu-latest

    env:
      NODE_OPTIONS: --max_old_space_size=8192

    steps:
    - uses: actions/checkout@v3
      with:
        ref: ${{github.event.inputs.branch}}
        token: ${{secrets.YARNBOT_TOKEN}}

    - name: 'Retrieve all the relevant tags'
      run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

    - name: 'Use Node.js ${{ env.node-version }}'
      uses: actions/setup-node@v4
      with:
        node-version: ${{ env.node-version }}

    - name: 'Build a binary for convenience'
      run: |
        yarn build:cli

        TMPBIN=$(mktemp -d)
        cp ./packages/yarnpkg-cli/bundles/yarn.js $TMPBIN/yarn.js

        grep -v "yarnPath:" .yarnrc.yml > $TMPBIN/.yarnrc.yml
        cp $TMPBIN/.yarnrc.yml .yarnrc.yml
        echo "yarnPath: '$TMPBIN/yarn.js'" >> .yarnrc.yml
        git update-index --skip-worktree -- .yarnrc.yml

    - name: 'Generate the release commits'
      run: |
        git config user.name "Yarn Bot"
        git config user.email nison.mael+yarnbot@gmail.com

        OLD_VERSION=$(YARN_IGNORE_PATH=1 node ./packages/yarnpkg-cli/bin/yarn.js --version)
        ./scripts/release/01-release-tags.sh
        NEW_VERSION=$(YARN_IGNORE_PATH=1 node ./packages/yarnpkg-cli/bin/yarn.js --version)

        git push --follow-tags

        if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
          GH_TOKEN="${{secrets.YARNBOT_TOKEN}}" gh release create "@yarnpkg/cli/$NEW_VERSION" --title "v$NEW_VERSION" --verify-tag --generate-notes --notes-start-tag "@yarnpkg/cli/$OLD_VERSION"
        fi

    - name: 'Upload the releases'
      run: |
        yarn config set -H 'npmAuthToken' "${{secrets.YARNBOT_NPM_TOKEN}}"
        yarn config set -H 'npmRegistries["//npm.pkg.github.com"].npmAuthToken' "${{secrets.YARNBOT_TOKEN}}"
        ./scripts/release/02-release-builds.sh
        ./scripts/release/03-release-npm.sh

    - name: 'Updates the stableVersion field'
      run: |
        # Revert the change from "Build a binary for convenience"
        git update-index --no-skip-worktree -- .yarnrc.yml
        git checkout HEAD -- .yarnrc.yml

        RELEASE_COMMIT=$(git rev-parse HEAD)
        node ./scripts/stable-versions-store.js
        git fetch origin master
        git checkout master
        node ./scripts/stable-versions-restore.js
        HEAD_COMMIT=$(git rev-parse HEAD)

        git reset --soft $HEAD_COMMIT
        git checkout $RELEASE_COMMIT -- packages/*/bin/**
        git add .
        git commit -m 'Sync master with the changes from ${{github.event.inputs.branch}}'
        git push