ld: generate checksums on release and open pull request #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ld | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Create GitHub Release' | |
required: false | |
type: boolean | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
paths: | |
- '.github/workflows/ld.yml' | |
- 'src/ld/**' | |
- 'docker-bake.hcl' | |
pull_request: | |
paths: | |
- '.github/workflows/ld.yml' | |
- 'src/ld/**' | |
- 'docker-bake.hcl' | |
env: | |
# needs latest for output platform-split support | |
BUILDKIT_IMAGE: "moby/buildkit:latest" | |
jobs: | |
binutils-targets: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.targets.outputs.matrix }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Create targets matrix | |
id: targets | |
run: | | |
matrix=$(docker buildx bake binutils --print | jq -cr '.group.binutils.targets') | |
echo "matrix=${matrix}" >> ${GITHUB_OUTPUT} | |
- | |
name: Show matrix | |
run: | | |
echo ${{ steps.targets.outputs.matrix }} | |
binutils: | |
runs-on: ubuntu-latest | |
needs: | |
- binutils-targets | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{ fromJson(needs.binutils-targets.outputs.matrix) }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Build | |
uses: docker/bake-action@v2 | |
with: | |
targets: ${{ matrix.target }} | |
set: | | |
*.cache-from=type=gha,scope=${{ matrix.target }} | |
*.cache-to=type=gha,scope=${{ matrix.target }} | |
ld64-targets: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.targets.outputs.matrix }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Create targets matrix | |
id: targets | |
run: | | |
matrix=$(docker buildx bake ld64-static-tgz --print | jq -cr '.group."ld64-static-tgz".targets') | |
echo "matrix=${matrix}" >> ${GITHUB_OUTPUT} | |
- | |
name: Show matrix | |
run: | | |
echo ${{ steps.targets.outputs.matrix }} | |
ld64: | |
runs-on: ubuntu-latest | |
needs: | |
- ld64-targets | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{ fromJson(needs.ld64-targets.outputs.matrix) }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: image=${{ env.BUILDKIT_IMAGE }} | |
- | |
name: Build | |
uses: docker/bake-action@v2 | |
with: | |
targets: ${{ matrix.target }} | |
set: | | |
*.cache-from=type=gha,scope=${{ matrix.target }} | |
*.cache-to=type=gha,scope=${{ matrix.target }} | |
*.output=type=local,dest=./dist,platform-split=false | |
- | |
name: List artifacts | |
run: | | |
tree -nh ./dist | |
- | |
name: Upload artifacts | |
if: ${{ inputs.release }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ld | |
path: ./dist/* | |
if-no-files-found: error | |
retention-days: 1 | |
ld-targets: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.targets.outputs.matrix }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Create targets matrix | |
id: targets | |
run: | | |
matrix=$(docker buildx bake ld-static-tgz --print | jq -cr '.group."ld-static-tgz".targets') | |
echo "matrix=${matrix}" >> ${GITHUB_OUTPUT} | |
- | |
name: Show matrix | |
run: | | |
echo ${{ steps.targets.outputs.matrix }} | |
ld: | |
runs-on: ubuntu-latest | |
needs: | |
- ld-targets | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{ fromJson(needs.ld-targets.outputs.matrix) }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: image=${{ env.BUILDKIT_IMAGE }} | |
- | |
name: Build | |
uses: docker/bake-action@v2 | |
with: | |
targets: ${{ matrix.target }} | |
set: | | |
*.cache-from=type=gha,scope=${{ matrix.target }} | |
*.cache-to=type=gha,scope=${{ matrix.target }} | |
*.output=type=local,dest=./dist,platform-split=false | |
- | |
name: List artifacts | |
run: | | |
tree -nh ./dist | |
- | |
name: Upload artifacts | |
if: ${{ inputs.release }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ld | |
path: ./dist/* | |
if-no-files-found: error | |
retention-days: 1 | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ inputs.release }} | |
needs: | |
- ld | |
- ld64 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Prepare | |
run: | | |
version=$(docker buildx bake ld-linux-amd64-static-tgz --print | jq -cr '.target."ld-linux-amd64-static-tgz".args."BINUTILS_VERSION"') | |
echo "VERSION=${version}" >> $GITHUB_ENV | |
- | |
name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ld | |
path: ./dist | |
- | |
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/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Generate src/xx-ld-shas | |
run: | | |
bash ./hack/generate-ld-shas | |
env: | |
DIST: ./dist | |
GITHUB_RELEASE_TAG: prebuilt/ld-${{ env.VERSION }}-${{ github.run_number }} | |
- | |
name: Create PR | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | |
with: | |
base: master | |
branch: bot/generate-ld-shas | |
commit-message: "update src/xx-ld-shas" | |
add-paths: src/xx-ld-shas | |
signoff: true | |
delete-branch: true | |
title: "Update `src/xx-ld-shas`" | |
draft: false |