Skip to content

Commit

Permalink
ci: generate xx-ld-shas
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Feb 12, 2023
1 parent cc7e0fe commit 1df70ec
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 5 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/prebuilt-ld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
branches:
- 'master'

env:
DIST: ./bin

jobs:
targets:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,18 +58,18 @@ jobs:
with:
targets: ${{ matrix.target }}
set: |
*.output=./dist
*.output=${{ env.DIST }}
-
name: Move artifacts
run: |
mv ./dist/**/* ./dist/ || true
mv ${{ env.DIST }}/**/* ${{ env.DIST }}/ || true
-
name: Upload artifacts
if: ${{ inputs.release }}
uses: actions/upload-artifact@v3
with:
name: prebuilt-ld
path: ./dist/*
path: ${{ env.DIST }}/*
if-no-files-found: error
retention-days: 5

Expand All @@ -89,13 +92,32 @@ jobs:
uses: actions/download-artifact@v3
with:
name: prebuilt-ld
path: ./dist
path: ./bin
-
name: GitHub Release
uses: softprops/action-gh-release@v1
with:
name: prebuilt/ld-${{ env.VERSION }}-${{ github.run_number }}
tag_name: prebuilt/ld-${{ env.VERSION }}-${{ github.run_number }}
files: dist/*
files: ${{ env.DIST }}/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Generate base/xx-ld-shas
run: |
bash ./hack/generate-ld-shas
-
name: Commit changes
run: |
git add -A .
-
name: Create PR
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04
with:
base: master
branch: bot/prebuilt-ld
commit-message: "update base/xx-ld-shas"
signoff: true
delete-branch: true
title: "Update `base/xx-ld-shas`"
draft: false
38 changes: 38 additions & 0 deletions hack/generate-ld-shas
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e

: "${DIST=./bin/prebuilt-ld}"

cat >./base/xx-ld-shas <<EOL
#!/usr/bin/env sh
# DO NOT EDIT! Generated by ".github/workflows/prebuilt-ld.yml"
LD_SHAS=\$(
cat <<'EOT'
EOL

for file in "${DIST}"/*-ld-*; do
echo "$(basename -- "${file%.tar.gz}") $(sha1sum "$file" | cut -d' ' -f1)" >>./base/xx-ld-shas
done

cat >>./base/xx-ld-shas <<EOL
EOT
)
export LD_SHAS
LD64_SHAS=\$(
cat <<'EOT'
EOL

for file in "${DIST}"/ld64-*; do
echo "$(basename -- "${file%.tar.gz}") $(sha1sum "$file" | cut -d' ' -f1)" >>./base/xx-ld-shas
done

cat >>./base/xx-ld-shas <<EOL
EOT
)
export LD64_SHAS
EOL

cat ./base/xx-ld-shas

0 comments on commit 1df70ec

Please sign in to comment.