Skip to content

Commit b978174

Browse files
committed
fix: add release hook
1 parent 4bd4e28 commit b978174

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: "React to release"
2+
3+
on:
4+
repository_dispatch:
5+
types: [actions-release-trigger]
6+
7+
jobs:
8+
myEvent:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: "Checkout repository"
12+
uses: actions/checkout@v4
13+
14+
- name: "Update Releases"
15+
run: |
16+
set -x
17+
git checkout master
18+
git config user.name "$GITHUB_ACTOR"
19+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
20+
21+
SRC_REPO=${{ github.event.client_payload.caller_repository }}
22+
TAG=${{ github.event.client_payload.tag }}
23+
VERSION=${{ github.event.client_payload.version }}
24+
BUILD=${{ github.event.client_payload.build }}
25+
26+
CURRENT_RELEAE_VERSION_NUMBERS=( ${VERSION//./ } )
27+
RELEASE_VERSION_MAJOR=${CURRENT_RELEAE_VERSION_NUMBERS[0]}
28+
RELEASE_VERSION_MINOR=${CURRENT_RELEAE_VERSION_NUMBERS[1]}
29+
RELEASE_VERSION_PATCH=${CURRENT_RELEAE_VERSION_NUMBERS[2]}
30+
31+
echo "{" > api/versions/index.json
32+
echo " \"versions\": {" >> api/versions/index.json
33+
echo " \"latest\": {" >> api/versions/index.json
34+
echo " \"raw\": \"${VERSION}-${BUILD}.rc\"," >> api/versions/index.json
35+
echo " \"major\": \"${RELEASE_VERSION_MAJOR}\"," >> api/versions/index.json
36+
echo " \"minor\": \"${RELEASE_VERSION_MINOR}\"," >> api/versions/index.json
37+
echo " \"revision\": \"${RELEASE_VERSION_PATCH}\"," >> api/versions/index.json
38+
echo " \"pre\": \"${BUILD}\"," >> api/versions/index.json
39+
echo " \"build\": \"${BUILD}\"," >> api/versions/index.json
40+
echo " \"type\": \"rc\"" >> api/versions/index.json
41+
echo " }," >> api/versions/index.json
42+
echo " \"stable\": {" >> api/versions/index.json
43+
echo " \"raw\": \"${VERSION}-${BUILD}\"," >> api/versions/index.json
44+
echo " \"major\": \"${RELEASE_VERSION_MAJOR}\"," >> api/versions/index.json
45+
echo " \"minor\": \"${RELEASE_VERSION_MINOR}\"," >> api/versions/index.json
46+
echo " \"revision\": \"${RELEASE_VERSION_PATCH}\"," >> api/versions/index.json
47+
echo " \"pre\": \"${BUILD}\"," >> api/versions/index.json
48+
echo " \"build\": \"${BUILD}\"," >> api/versions/index.json
49+
echo " \"type\": \"\"" >> api/versions/index.json
50+
echo " }" >> api/versions/index.json
51+
echo " }" >> api/versions/index.json
52+
echo "}" >> api/versions/index.json
53+
54+
git add api/versions/index.json
55+
56+
if [[ "${{ github.event.client_payload.action }}" == "test" ]]; then
57+
echo "just testing"
58+
cat api/versions/index.json
59+
else
60+
git commit -m "triggered new $TYPE version ${VERSION}"
61+
REMOTE="https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
62+
git push "$REMOTE"
63+
fi

0 commit comments

Comments
 (0)