Skip to content

Update Team Components #31

Update Team Components

Update Team Components #31

name: Update Team Components
on:
workflow_dispatch:
inputs:
teamName:
description: 'Name of the new team'
required: true
permissions:
contents: write
jobs:
update-components:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{secrets.RANCHER_EIO_GITHUB_TOKEN}}
- name: Create components directory
run: mkdir -p ./github/team-creation/components
- name: Create new team component file from template
run: |
sed "s/TEAM_NAME/${{ github.event.inputs.teamName }}/g" ./github/team-creation/component-template.yaml > ./github/team-creation/components/${{ github.event.inputs.teamName }}-component.yaml
- name: Install yq (YAML Processor)
run: |
sudo snap install yq
- name: Update team-components.yaml
run: |
yq e ".spec.targets += [\"./components/${{ github.event.inputs.teamName }}-component.yaml\"]" -i ./github/team-creation/team-components.yaml
# - name: Set Git Remote URL with Token
# run: git remote set-url origin https://x-access-token:${{ secrets.RANCHER_EIO_GITHUB_TOKEN }}@github.com/rancher-eio/backstage-templates.git
- name: Commit and Push Changes
run: |
git config --global user.name 'rancherbot'
git config --global user.email 'rancherbot@rancher.com'
git add .
git commit -m "Add new team: ${{ github.event.inputs.teamName }}"
git push
#git remote set-url --push origin https://rancherbot:$GITHUB_TOKEN@github.com/rancher-eio/backstage-templates
#git push --set-upstream origin HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.RANCHER_EIO_GITHUB_TOKEN }}