From e808ec5f2757b17e563a9415f0a5d0447d081447 Mon Sep 17 00:00:00 2001 From: Michael Sprengel Date: Fri, 24 Nov 2023 15:49:07 +0100 Subject: [PATCH] Test gh_release --- .github/workflows/build_pkg.yml | 9 ++++----- scripts/gh_release | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 1435e41..e7e7a38 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -38,6 +38,7 @@ jobs: - uses: actions/checkout@v4 with: repository: gardenlinux/package-build + ref: feature/5-remove-pkg-yml - run: mkdir input output - uses: actions/checkout@v4 with: @@ -87,12 +88,8 @@ jobs: - name: draft release and upload source packages id: release if: ${{ steps.check.outputs.skip_release != 'true' }} - env: - ARTIFACT_NAME: ${{ steps.build.outputs.pkg }} - ARTIFACT_COMMIT: ${{ github.sha }} run: | - ARTIFACT_TAG=${ARTIFACT_NAME/\~/\_} - release="$(./scripts/gh_release "${{ github.token }}" "${{ github.repository }}" create --draft "${ARTIFACT_TAG}" "${ARTIFACT_COMMIT}" "${ARTIFACT_NAME}")" + release="$(./scripts/gh_release "${{ github.token }}" "${{ github.repository }}" create --draft "${{ steps.build.outputs.pkg }}" "${{ github.sha }}" "${{ steps.build.outputs.pkg }}")" for f in output/*; do ./scripts/gh_release "${{ github.token }}" "${{ github.repository }}" upload "$release" "$f" done @@ -113,6 +110,7 @@ jobs: - uses: actions/checkout@v4 with: repository: gardenlinux/package-build + ref: feature/5-remove-pkg-yml - name: setup binfmt if: ${{ matrix.arch == 'arm64v8' }} run: sudo podman run --privileged ghcr.io/gardenlinux/binfmt_container @@ -170,6 +168,7 @@ jobs: - uses: actions/checkout@v4 with: repository: gardenlinux/package-build + ref: feature/5-remove-pkg-yml - name: publish drafted release run: ./scripts/gh_release "${{ github.token }}" "${{ github.repository }}" publish_draft "${{ needs.source.outputs.release }}" cleanup: diff --git a/scripts/gh_release b/scripts/gh_release index eb0e863..7e79985 100755 --- a/scripts/gh_release +++ b/scripts/gh_release @@ -64,6 +64,8 @@ case "$action" in commit="$1"; shift name="$1"; shift + normalized_tag=${name/\~/\_} + release="$(post "releases" '{ "draft": '"$draft"', "tag_name": "'"$tag"'", @@ -78,16 +80,25 @@ case "$action" in release="$1"; shift asset_file="$1"; shift - asset_name="$(basename "$asset_file")" + normalized_asset_file=${asset_file/\~/\_} + + asset_name="$(basename "$normalized_asset_file")" upload "releases/$release/assets?name=$asset_name" < "$asset_file" > /dev/null - echo "uploaded $asset_file to $release" + echo "uploaded $asset_file to $release ($asset_name)" ;; "download") release="$1"; shift name="$1"; shift - asset_id="$(get "releases/$release/assets" | jq -r '.[] | select(.name == "'"$name"'") | .id')" + echo $name + + normalized_name=${name/\~/\_} + + echo $normalized_name + get "releases/$release/assets" + + asset_id="$(get "releases/$release/assets" | jq -r '.[] | select(.name == "'"$normalized_name"'") | .id')" get_binary "releases/assets/$asset_id" > "$name" ;;