From 38f325a36e51794fdc4ea3d58118add7b9be9642 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 11 Aug 2024 21:24:24 -0400 Subject: [PATCH] convert sh to yaml format --- .forgejo/bin/deploy.sh | 26 -------------------------- .forgejo/workflows/build.yaml | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 27 deletions(-) delete mode 100755 .forgejo/bin/deploy.sh diff --git a/.forgejo/bin/deploy.sh b/.forgejo/bin/deploy.sh deleted file mode 100755 index 3138b69..0000000 --- a/.forgejo/bin/deploy.sh +++ /dev/null @@ -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 - diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 39283e2..38bdd63 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -37,5 +37,27 @@ jobs: - run: apk add nodejs curl findutils git gawk - uses: actions/checkout@v4 - uses: forgejo/download-artifact@v4 + - name: Finding files + id: finding-files + run: | + { + echo 'FILELIST<> "$GITHUB_ENV" - 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 +