Bump dependencies #227
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bump dependencies | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Release Branch' | |
required: true | |
default: '8.4' | |
type: string | |
bump: | |
description: 'Bump type' | |
required: true | |
default: 'patch' | |
type: choice | |
options: | |
- "patch" | |
- "minor" | |
- "major" | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
version_bumper: | |
name: Bump versions | |
runs-on: ubuntu-latest | |
env: | |
INPUTS_BRANCH: "${{ inputs.branch }}" | |
INPUTS_BUMP: "${{ inputs.bump }}" | |
BACKPORT_LABEL: "backport-${{ inputs.branch }}" | |
steps: | |
- name: Fetch logstash-core team member list | |
uses: tspascoal/get-user-teams-membership@57e9f42acd78f4d0f496b3be4368fc5f62696662 #v3.0.0 | |
with: | |
username: ${{ github.actor }} | |
organization: elastic | |
team: logstash | |
GITHUB_TOKEN: ${{ secrets.READ_ORG_SECRET_JSVD }} | |
- name: Is user a core team member? | |
if: ${{ steps.checkUserMember.outputs.isTeamMember == 'false' }} | |
run: exit 1 | |
- name: checkout repo content | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.INPUTS_BRANCH }} | |
- run: git config --global user.email "[email protected]" | |
- run: git config --global user.name "logstashmachine" | |
- run: ./gradlew clean installDefaultGems | |
- run: ./vendor/jruby/bin/jruby -S bundle update --all --${{ env.INPUTS_BUMP }} --strict | |
- run: mv Gemfile.lock Gemfile.jruby-*.lock.release | |
- run: echo "T=$(date +%s)" >> $GITHUB_ENV | |
- run: echo "BRANCH=update_lock_${T}" >> $GITHUB_ENV | |
- run: | | |
git checkout -b $BRANCH | |
git add . | |
git status | |
if [[ -z $(git status --porcelain) ]]; then echo "No changes. We're done."; exit 0; fi | |
git commit -m "Update ${{ env.INPUTS_BUMP }} plugin versions in gemfile lock" -a | |
git push origin $BRANCH | |
- name: Update mergify (minor only) | |
if: ${{ inputs.bump == 'minor' }} | |
continue-on-error: true | |
run: make -C .ci mergify BACKPORT_LABEL=$BACKPORT_LABEL BRANCH=$INPUTS_BRANCH PUSH_BRANCH=$BRANCH | |
- name: Create Pull Request | |
run: | | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -d "{\"title\": \"bump lock file for ${{ env.INPUTS_BRANCH }}\",\"head\": \"${BRANCH}\",\"base\": \"${{ env.INPUTS_BRANCH }}\"}" https://api.github.com/repos/elastic/logstash/pulls | |
- name: Create GitHub backport label (Mergify) (minor only) | |
if: ${{ inputs.bump == 'minor' }} | |
continue-on-error: true | |
run: make -C .ci backport-label BACKPORT_LABEL=$BACKPORT_LABEL | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |