[Jeli 93] Fix deprecated function error with reload core (#198) #9
Workflow file for this run
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: Create Branch on Tag Push | |
on: | |
push: | |
tags: | |
- '*' | |
permissions: | |
pull-requests: read | |
contents: write | |
jobs: | |
create-branch: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'pantheon-systems/search_api_pantheon' }} | |
env: | |
BRANCH: ${{ github.ref_name }} | |
WORKSPACE: ${{ github.workspace }} | |
DRUPAL_ORG_REMOTE: ${{ secrets.DRUPAL_ORG_REMOTE }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
if_key_exists: ignore | |
- name: Extract tag name | |
id: tag_name | |
run: | | |
FULL_TAG=${GITHUB_REF#refs/tags/} | |
MAJOR_MINOR="$(echo $FULL_TAG | cut -d '.' -f 1,2).x" | |
MAJOR_ONLY="$(echo $FULL_TAG | cut -d '.' -f 1).x" | |
echo "BRANCH_NAME=$MAJOR_MINOR" >> $GITHUB_OUTPUT | |
echo "MAJOR_BRANCH_NAME=$MAJOR_ONLY" >> $GITHUB_OUTPUT | |
- name: Check if branch exists | |
id: check_branch | |
run: | | |
git fetch | |
branch_existence=$(git ls-remote --heads origin ${{ steps.tag_name.outputs.BRANCH_NAME }}) | |
if [[ -z ${branch_existence} ]]; then | |
echo "Branch for tag does not exist." | |
echo "exists=false" >> $GITHUB_OUTPUT | |
else | |
echo "Branch for tag already exists." | |
echo "exists=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Create branch | |
if: steps.check_branch.outputs.exists == 'false' | |
run: | | |
git checkout -b ${{ steps.tag_name.outputs.BRANCH_NAME }} origin/${{ steps.tag_name.outputs.MAJOR_BRANCH_NAME }} | |
git push origin ${{ steps.tag_name.outputs.BRANCH_NAME }} | |
- name: Merge changes from current default branch | |
if: steps.check_branch.outputs.exists == 'true' | |
run: | | |
git fetch | |
git checkout -b ${{ steps.tag_name.outputs.BRANCH_NAME }} origin/${{ steps.tag_name.outputs.BRANCH_NAME }} | |
git merge origin/${{ steps.tag_name.outputs.MAJOR_BRANCH_NAME }} | |
git push origin HEAD:${{ steps.tag_name.outputs.BRANCH_NAME }} | |
- name: Pushes to drupal.org repository | |
run: | | |
cd $WORKSPACE | |
git remote add drupalorg $DRUPAL_ORG_REMOTE | |
git push drupalorg HEAD:${{ steps.tag_name.outputs.BRANCH_NAME }} |