convert sh to yaml format
All checks were successful
/ lint (pull_request) Successful in 24s

This commit is contained in:
Antoine Martin 2024-08-11 21:24:24 -04:00
parent fa59f4eb1e
commit 38f325a36e
Signed by: forge
GPG key ID: D62A472A4AA7D541
2 changed files with 23 additions and 27 deletions

View file

@ -1,26 +0,0 @@
#!/bin/sh
# shellcheck disable=SC3040
set -eu -o pipefail
readonly REPOS="backports user"
readonly BASEBRANCH=$GITHUB_BASE_REF
readonly TARGET_REPO=$CI_ALPINE_REPO
apkgs=$(find package -type f -name "*.apk")
for apk in $apkgs; do
branch=$(echo $apk | awk -F '/' '{print $2}')
arch=$(echo $apk | awk -F '/' '{print $3}')
name=$(echo $apk | awk -F '/' '{print $4}')
echo "Sending $name of arch $arch to $TARGET_REPO/$BASEBRANCH/$branch"
return=$(curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN --upload-file $apk $TARGET_REPO/$BASEBRANCH/$branch 2>&1)
echo $return
if [ "$return" == "package file already exists" ]; then
echo "Package already exists, refreshing..."
curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN -X DELETE $TARGET_REPO/$BASEBRANCH/$branch/$arch/$name
curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN --upload-file $apk $TARGET_REPO/$BASEBRANCH/$branch
fi
done

View file

@ -37,5 +37,27 @@ jobs:
- run: apk add nodejs curl findutils git gawk - run: apk add nodejs curl findutils git gawk
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: forgejo/download-artifact@v4 - uses: forgejo/download-artifact@v4
- name: Finding files
id: finding-files
run: |
{
echo 'FILELIST<<EOF'
find package -type f -name "*.apk"
echo EOF
} >> "$GITHUB_ENV"
- name: Deploy to repo - name: Deploy to repo
run: ${{ github.workspace }}/.forgejo/bin/deploy.sh run: |
for apk in $FILELIST; do
branch=$(echo $apk | awk -F '/' '{print $2}')
arch=$(echo $apk | awk -F '/' '{print $3}')
name=$(echo $apk | awk -F '/' '{print $4}')
echo "Sending $name of arch $arch to $TARGET_REPO/$BASEBRANCH/$branch"
return=$(curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN --upload-file $apk $TARGET_REPO/$BASEBRANCH/$branch 2>&1)
if [ "$return" == "package file already exists" ]; then
echo "Package already exists, refreshing..."
curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN -X DELETE $TARGET_REPO/$BASEBRANCH/$branch/$arch/$name
curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN --upload-file $apk $TARGET_REPO/$BASEBRANCH/$branch
fi
done