-
Notifications
You must be signed in to change notification settings - Fork 15
112 lines (93 loc) · 3.77 KB
/
push_pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
on:
release:
types: [ created ]
name: push-changes-on-release
jobs:
send-pull-requests:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Get production version from tag
id: get_version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout to repo
uses: actions/checkout@v3
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Create release file
run: |
TITLE='${{ github.event.release.name }}'
NOTES='${{ github.event.release.body }}'
DATE=$(date '+%d-%m-%Y')
mkdir -p deployments
echo $NOTES >> "deployments/release-$TITLE-$DATE.txt"
git config user.email "[email protected]"
git config user.name "curvefi"
git remote update
git fetch
git checkout main
git add deployments
git commit -m "chore: add release file - $TITLE"
git push
- name: Checkout to curve-js
uses: actions/checkout@v3
with:
repository: curvefi/curve-js
token: ${{ secrets.ACCESS_TOKEN }}
- name: Send pull-request to curve-js
run: |
TAG=${{ env.RELEASE_VERSION }}
ORG="curvefi"
CURRENT_REPOSITORY="${{ github.repository }}"
REPOSITORY="$ORG/curve-js"
FOLDER="bin/$REPOSITORY"
BRANCH_NAME="deployment-$CURRENT_REPOSITORY-$TAG"
# Setup the committers identity.
git config user.email "[email protected]"
git config user.name "Curvefi"
# Create a new feature branch for the changes.
git checkout -b $BRANCH_NAME
# Store the PAT in a file that can be accessed by the GitHub CLI.
echo "${{ secrets.ACCESS_TOKEN }}" > token.txt
# Create an empty commit for PR
git commit --allow-empty -m "deployment from $CURRENT_REPOSITORY - $TAG"
git push -u origin $BRANCH_NAME
# Authorize GitHub CLI for the current repository and
# create a pull-requests containing the updates.
gh auth login --with-token < token.txt
gh pr create \
--body "${{ github.event.release.body }}" \
--title "Deployment from $CURRENT_REPOSITORY - $TAG" \
--head "$BRANCH_NAME" \
--base "master"
- name: Checkout to curve-api
uses: actions/checkout@v3
with:
repository: curvefi/curve-api
token: ${{ secrets.ACCESS_TOKEN }}
- name: Send pull-request to curve-api
run: |
TAG=${{ env.RELEASE_VERSION }}
ORG="curvefi"
CURRENT_REPOSITORY="${{ github.repository }}"
REPOSITORY="$ORG/curve-api"
FOLDER="bin/$REPOSITORY"
BRANCH_NAME="deployment-$CURRENT_REPOSITORY-$TAG"
# Setup the committers identity.
git config user.email "[email protected]"
git config user.name "Curvefi"
# Create a new feature branch for the changes.
git checkout -b $BRANCH_NAME
# Store the PAT in a file that can be accessed by the GitHub CLI.
echo "${{ secrets.ACCESS_TOKEN }}" > token.txt
# Create an empty commit for PR
git commit --allow-empty -m "deployment from $CURRENT_REPOSITORY - $TAG"
git push -u origin $BRANCH_NAME
# Authorize GitHub CLI for the current repository and
# create a pull-requests containing the updates.
gh auth login --with-token < token.txt
gh pr create \
--body "${{ github.event.release.body }}" \
--title "Deployment from $CURRENT_REPOSITORY - $TAG" \
--head "$BRANCH_NAME" \
--base "main"