Update Team Components #21
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: 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/create-team/components | |
- name: Create new team component file from template | |
run: | | |
sed "s/TEAM_NAME/${{ github.event.inputs.teamName }}/g" ./github/create-team/component-template.yaml > ./github/create-team/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/create-team/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 }} |