diff --git a/.github/workflows/binutils.yml b/.github/workflows/binutils.yml index b16e7b3..5dc6348 100644 --- a/.github/workflows/binutils.yml +++ b/.github/workflows/binutils.yml @@ -6,6 +6,16 @@ concurrency: on: workflow_dispatch: + inputs: + repo: + description: 'Registry repo' + required: true + default: 'tonistiigi/xx' + type: string + release: + description: 'Push image and create GitHub Release' + required: false + type: boolean push: branches: - 'master' @@ -17,6 +27,9 @@ on: paths: - 'src/ld/**' +env: + XX_REPO_DEFAULT: "tonistiigi/xx" + jobs: binutils-targets: runs-on: ubuntu-latest @@ -55,11 +68,45 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - + name: Login to DockerHub + if: ${{ inputs.release }} + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build uses: docker/bake-action@v2 with: targets: ${{ matrix.target }} + push: ${{ inputs.release || false }} set: | *.cache-from=type=gha,scope=${{ matrix.target }} *.cache-to=type=gha,scope=${{ matrix.target }} + env: + XX_REPO: ${{ inputs.repo || XX_REPO_DEFAULT }} + + release: + runs-on: ubuntu-latest + if: ${{ inputs.release }} + needs: + - binutils + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Prepare + run: | + version=$(docker buildx bake _binutils-version --print | jq -cr '.target."_binutils-version".args."BINUTILS_VERSION"') + echo "VERSION=${version}" >> $GITHUB_ENV + - + # TODO: Create release notes with list of image tags pushed + name: GitHub Release + uses: crazy-max/ghaction-github-release@v1 + with: + name: binutils/${{ env.VERSION }}-${{ github.run_number }} + tag_name: binutils/${{ env.VERSION }}-${{ github.run_number }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}