Skip to content

Commit 0cf8e0b

Browse files
authored
Create app_catalog_upd.yml
1 parent 4f2520c commit 0cf8e0b

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Update Flipper Application Catalog
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'application.fam'
9+
10+
jobs:
11+
update-catalog:
12+
runs-on: ubuntu-latest
13+
14+
env:
15+
BRANCH_PREFIX: zacharyweiss/
16+
APP_NAME: magspoof
17+
APP_FOLDER: GPIO
18+
CATALOG_REPO: zacharyweiss/flipper-application-catalog
19+
CATALOG_UPSTREAM: flipperdevices/flipper-application-catalog
20+
CATALOG_FOLDER: flipper-application-catalog
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
path: ${{ env.APP_NAME }}
27+
28+
- name: Get fap_version
29+
id: fap_version
30+
run: |
31+
cd $APP_NAME
32+
fap_version_raw=$(grep -oP '(?<=fap_version=\()\d+, \d+(?=\))' application.fam)
33+
v_major=$(echo $fap_version_raw | cut -d "," -f 1 | xargs)
34+
v_minor=$(echo $fap_version_raw | cut -d "," -f 2 | xargs)
35+
echo "v_major=$v_major" >> "$GITHUB_ENV"
36+
echo "v_minor=$v_minor" >> "$GITHUB_ENV"
37+
echo "branch_name=${BRANCH_PREFIX}${APP_NAME}_v${v_major}.${v_minor}" >> "$GITHUB_ENV"
38+
39+
- name: Checkout App Catalog
40+
uses: actions/checkout@v4
41+
with:
42+
repository: ${{ env.CATALOG_REPO }}
43+
path: ${{ env.CATALOG_FOLDER }}
44+
token: ${{ secrets.CATALOG_UPDATE_TOKEN }}
45+
46+
- name: Create Branch & Fetch Upstream
47+
run: |
48+
cd $CATALOG_FOLDER
49+
git checkout -b "$branch_name"
50+
git remote add upstream "https://x-access-token:${{ secrets.CATALOG_UPDATE_TOKEN }}@github.com/$CATALOG_UPSTREAM.git"
51+
git fetch upstream main
52+
git remote -v
53+
git rebase --autosquash --autostash "upstream/main"
54+
# git remote set-url origin "https://x-access-token:${{ secrets.CATALOG_UPDATE_TOKEN }}@github.com/$CATALOG_REPO.git"
55+
56+
- name: Update manifest.yml
57+
run: |
58+
manifest_path=applications/$APP_FOLDER/$APP_NAME/manifest.yml
59+
echo "manifest_path=$manifest_path" > "$GITHUB_ENV"
60+
sed -i 's/commit_sha: .*/commit_sha: ${{ github.sha }}/' $CATALOG_FOLDER/$manifest_path
61+
62+
- name: Commit
63+
run: |
64+
cd $CATALOG_FOLDER
65+
git config user.name "$GITHUB_ACTOR"
66+
git config user.email "[email protected]"
67+
git add .
68+
git commit -m "Update ${APP_NAME} manifest for v${v_major}.${v_minor} @ ${{ github.sha }}"
69+
# git push --force -u origin HEAD
70+
71+
- name: Push
72+
uses: ad-m/github-push-action@master
73+
with:
74+
github_token: ${{ secrets.CATALOG_UPDATE_TOKEN }}
75+
directory: ${{ env.CATALOG_FOLDER }}
76+
branch: ${{ env.branch_name }}
77+
repository: ${{ env.CATALOG_REPO }}
78+
force: true

0 commit comments

Comments
 (0)