chore: Post release bumps #964
This file contains 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: "Revert k-apps ref" | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: {} | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
get-kapps-branch-name: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'open-kommander-pr') | |
outputs: | |
branch_name: ${{ steps.branch-name.outputs.branch_name }} | |
escaped_branch_name: ${{ steps.escaped-branch-name.outputs.escaped_branch_name }} | |
base_branch_name: ${{ steps.base-branch-name.outputs.base_branch_name }} | |
steps: | |
- id: branch-name | |
run: echo "::set-output name=branch_name::${{ github.head_ref }}" | |
- id: escaped-branch-name | |
run: echo "::set-output name=escaped_branch_name::$(echo ${{ github.head_ref }} | sed -e 's/\//\\\//g')" | |
- id: base-branch-name | |
run: echo "::set-output name=base_branch_name::${{ github.base_ref }}" | |
- name: Check output branch-name | |
run: echo ${{ steps.branch-name.outputs.branch_name }} | |
- name: Check output escaped-branch-name | |
run: echo ${{ steps.escaped-branch-name.outputs.escaped_branch_name }} | |
- name: Check output base-branch-name | |
run: echo ${{ steps.base-branch-name.outputs.base_branch_name }} | |
update-kommander-branch: | |
runs-on: ubuntu-latest | |
needs: get-kapps-branch-name | |
if: success() | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'mesosphere/kommander' | |
ssh-key: ${{ secrets.KOMM_PRIVATE_SSH_KEY }} | |
path: 'kommander' | |
fetch-depth: '0' | |
- name: Revert kommander-applications ref back to ${{ needs.get-kapps-branch-name.outputs.base_branch_name }} on kommander branch | |
run: | | |
cd kommander | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
# If branch does not exist, do nothing | |
git show-ref --quiet --verify -- refs/remotes/origin/kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }} && { | |
git checkout kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }} | |
# Point the kommander-applications ref to the k-apps branch | |
sed -i 's/KOMMANDER_APPLICATIONS_REF ?= ${{ needs.get-kapps-branch-name.outputs.escaped_branch_name }}/KOMMANDER_APPLICATIONS_REF ?= ${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/' Makefile | |
git add Makefile | |
if output=$(git status --porcelain) && [ ! -z "$output" ]; then | |
git commit -v -m "build: Point kommander-applications ref back to ${{ needs.get-kapps-branch-name.outputs.base_branch_name }}" | |
git push --force-with-lease --set-upstream origin kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }} | |
fi | |
} |