1+ name : Update Cli Repository
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ env :
8+ service_to_update : ' storage-api'
9+ cli_repo_owner : supabase
10+ cli_repo : cli
11+ cli_repo_main_branch : ' main'
12+ cli_repo_pr_title : ' fix(storage): update storage image version to '
13+ github_user : ' Supa CLI Bot'
14+ github_user_email : ' fabri.feno@gmail.com'
15+
16+ jobs :
17+ update-remote-repo :
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - name : Setup Git config
22+ run : |
23+ git config --global user.name '${{ env.github_user }}'
24+ git config --global user.email '${{ env.github_user_email }}'
25+
26+ - name : Checkout remote repository
27+ uses : actions/checkout@v2
28+ with :
29+ repository : ' ${{ env.cli_repo_owner }}/${{ env.cli_repo }}'
30+ token : ${{ secrets.CLI_PR_USER_ACCESS_TOKEN }}
31+ path : ' ${{ env.cli_repo }}'
32+
33+ - name : Create a new branch
34+ run : |
35+ cd '${{ env.cli_repo }}'
36+ git checkout -b '${{ env.service_to_update }}/${{ github.ref_name }}'
37+
38+ - name : Update file
39+ run : |
40+ cd '${{ env.cli_repo }}'
41+ sed -i 's/${{ env.cli_repo_owner }}\/${{ env.service_to_update }}:v[0-9]*\.[0-9]*\.[0-9]*/${{ env.cli_repo_owner }}\/${{ env.service_to_update }}:${{ github.ref_name }}/' internal/utils/misc.go
42+
43+ - name : Commit changes
44+ run : |
45+ cd '${{ env.cli_repo }}'
46+ git add .
47+ git commit -m "Update ${{ env.service_to_update }} version to ${{ github.ref_name }}"
48+
49+ - name : Push changes
50+ run : |
51+ cd '${{ env.cli_repo }}'
52+ git push origin '${{ env.service_to_update }}/${{ github.ref_name }}'
53+
54+ - name : Create Pull Request
55+ run : |
56+ cd '${{ env.cli_repo }}'
57+ gh pr create --base '${{ env.cli_repo_main_branch }}' --title "${{ env.cli_repo_pr_title }} ${{ github.ref_name }}" --body "New version of ${{ env.service_to_update }} ${{ github.ref_name }} is now available!"
58+ env :
59+ GH_TOKEN : ${{ secrets.CLI_PR_USER_ACCESS_TOKEN }}
0 commit comments