...

Text file src/github.com/linkerd/linkerd2/.github/workflows/sync-proxy.yml

Documentation: github.com/linkerd/linkerd2/.github/workflows

     1name: Sync proxy
     2
     3on:
     4  workflow_dispatch:
     5    inputs:
     6      version:
     7        description: "The version of the proxy to sync"
     8        required: true
     9        default: "latest"
    10
    11concurrency:
    12  group: ${{ github.workflow }}-${{ github.head_ref }}
    13  cancel-in-progress: true
    14
    15jobs:
    16  meta:
    17    runs-on: ubuntu-22.04
    18    timeout-minutes: 5
    19    env:
    20      GH_REPO: ${{ vars.LINKERD2_PROXY_REPO || 'linkerd/linkerd2-proxy' }}
    21      GH_TOKEN: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
    22    steps:
    23      - if: inputs.version == 'latest' || inputs.version == ''
    24        id: latest
    25        run: gh release view --json tagName,name,url | jq -r 'to_entries[] | (.key + "=" + .value)' >> "$GITHUB_OUTPUT"
    26      - name: steps.latest.outputs.tagName=${{ steps.latest.outputs.tagName }}
    27        run: "true"
    28      - name: steps.latest.outputs.name=${{ steps.latest.outputs.name }}
    29        run: "true"
    30      - name: steps.latest.outputs.url=${{ steps.latest.outputs.url }}
    31        run: "true"
    32
    33      - if: inputs.version != 'latest' && inputs.version != ''
    34        id: known
    35        env:
    36          VERSION: ${{ inputs.version }}
    37        run: gh release view "$VERSION" --json tagName,name,url | jq -r 'to_entries[] | (.key + "=" + .value)' >> "$GITHUB_OUTPUT"
    38      - name: steps.known.outputs.tagName=${{ steps.known.outputs.tagName }}
    39        run: "true"
    40      - name: steps.known.outputs.name=${{ steps.known.outputs.name }}
    41        run: "true"
    42      - name: steps.known.outputs.url=${{ steps.known.outputs.url }}
    43        run: "true"
    44
    45      - name: Verify tagName
    46        if: steps.latest.outputs.tagName == '' && steps.known.outputs.tagName == ''
    47        run: exit 1
    48      - name: Verify name
    49        if: steps.latest.outputs.name == '' && steps.known.outputs.name == ''
    50        run: exit 1
    51      - name: Verify url
    52        if: steps.latest.outputs.url == '' && steps.known.outputs.url == ''
    53        run: exit 1
    54
    55    outputs:
    56      tagName: ${{ steps.latest.outputs.tagName || steps.known.outputs.tagName }}
    57      name: ${{ steps.latest.outputs.name || steps.known.outputs.name }}
    58      url: ${{ steps.latest.outputs.url || steps.known.outputs.url }}
    59
    60  changed:
    61    needs: meta
    62    runs-on: ubuntu-22.04
    63    timeout-minutes: 5
    64    env:
    65      VERSION: ${{ needs.meta.outputs.name }}
    66    steps:
    67      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
    68        with:
    69          token: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
    70      - name: Check if proxy version has changed
    71        id: changed
    72        run: |
    73          if [ "$(cat .proxy-version)" != "$VERSION" ]; then
    74            echo changed=true >> "$GITHUB_OUTPUT"
    75          fi
    76      - name: steps.changed.outputs.changed=${{ steps.changed.outputs.changed == 'true' }}
    77        run: "true"
    78    outputs:
    79      changed: ${{ steps.changed.outputs.changed == 'true' }}
    80
    81  sync-proxy:
    82    needs: [meta, changed]
    83    if: needs.changed.outputs.changed == 'true'
    84    runs-on: ubuntu-22.04
    85    timeout-minutes: 5
    86    permissions:
    87      checks: read
    88      contents: write
    89      pull-requests: write
    90    env:
    91      VERSION: ${{ needs.meta.outputs.name }}
    92      URL: ${{ needs.meta.outputs.url }}
    93    steps:
    94      - name: Configure git
    95        env:
    96          GITHUB_USERNAME: ${{ vars.LINKERD2_PROXY_GITHUB_USERNAME || 'github-actions[bot]' }}
    97        run: |
    98          git config --global --add safe.directory "$PWD" # actions/runner#2033
    99          git config --global user.name "$GITHUB_USERNAME"
   100          git config --global user.email "$GITHUB_USERNAME"@users.noreply.github.com
   101      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
   102        with:
   103          token: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
   104      - name: Commit proxy version
   105        run: |
   106          set -eu
   107          git fetch origin bot/sync-proxy/"$VERSION" || true
   108          git switch -c bot/sync-proxy/"$VERSION"
   109          echo "$VERSION" > .proxy-version
   110          git add .proxy-version
   111          (
   112            echo "proxy: $VERSION"
   113            echo
   114            echo "Release notes: $URL"
   115          ) >"$RUNNER_TEMP"/commit.txt
   116          git commit --signoff -F "$RUNNER_TEMP"/commit.txt
   117          git push origin bot/sync-proxy/"$VERSION"
   118      - env:
   119          GH_REPO: ${{ github.repository }}
   120          GH_TOKEN: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
   121        run: |
   122          gh pr create --title "proxy: $VERSION" --body "Release notes: $URL" --label bot/sync-proxy

View as plain text