Update Tools #837
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: Update Tools | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: {} | |
concurrency: tools_update | |
jobs: | |
update: | |
name: Update | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout Branch | |
uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main | |
with: | |
branch: automation/tools/update | |
- name: Fetch Latest Jam | |
id: latest-jam | |
uses: paketo-buildpacks/github-config/actions/tools/latest@main | |
with: | |
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} | |
repo: paketo-buildpacks/jam | |
- name: Fetch Latest pack | |
id: latest-pack | |
uses: paketo-buildpacks/github-config/actions/tools/latest@main | |
with: | |
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} | |
repo: buildpacks/pack | |
- name: Fetch Latest create-package | |
id: latest-create-package | |
uses: paketo-buildpacks/github-config/actions/tools/latest@main | |
with: | |
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} | |
repo: paketo-buildpacks/libpak | |
- name: Fetch Latest syft | |
id: latest-syft | |
uses: paketo-buildpacks/github-config/actions/tools/latest@main | |
with: | |
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} | |
repo: anchore/syft | |
- name: Update builder tools.json | |
env: | |
JAM_VERSION: ${{ steps.latest-jam.outputs.version }} | |
PACK_VERSION: ${{ steps.latest-pack.outputs.version }} | |
CREATE_PACKAGE_VERSION: ${{ steps.latest-create-package.outputs.version }} | |
run: | | |
jq --null-input \ | |
--sort-keys \ | |
--arg pack "${PACK_VERSION}" \ | |
'{ pack: $pack }' > ./builder/scripts/.util/tools.json | |
- name: Update implementation tools.json | |
env: | |
JAM_VERSION: ${{ steps.latest-jam.outputs.version }} | |
PACK_VERSION: ${{ steps.latest-pack.outputs.version }} | |
CREATE_PACKAGE_VERSION: ${{ steps.latest-create-package.outputs.version }} | |
run: | | |
jq --null-input \ | |
--sort-keys \ | |
--arg pack "${PACK_VERSION}" \ | |
--arg jam "${JAM_VERSION}" \ | |
--arg createpackage "${CREATE_PACKAGE_VERSION}" \ | |
'{ pack: $pack, jam: $jam, createpackage: $createpackage }' > ./implementation/scripts/.util/tools.json | |
- name: Update language-family tools.json | |
env: | |
JAM_VERSION: ${{ steps.latest-jam.outputs.version }} | |
PACK_VERSION: ${{ steps.latest-pack.outputs.version }} | |
CREATE_PACKAGE_VERSION: ${{ steps.latest-create-package.outputs.version }} | |
run: | | |
jq --null-input \ | |
--sort-keys \ | |
--arg pack "${PACK_VERSION}" \ | |
--arg jam "${JAM_VERSION}" \ | |
'{ pack: $pack, jam: $jam }' > ./language-family/scripts/.util/tools.json | |
- name: Update stack tools.json | |
env: | |
JAM_VERSION: ${{ steps.latest-jam.outputs.version }} | |
PACK_VERSION: ${{ steps.latest-pack.outputs.version }} | |
SYFT_VERSION: ${{ steps.latest-syft.outputs.version }} | |
run: | | |
jq --null-input \ | |
--sort-keys \ | |
--arg pack "${PACK_VERSION}" \ | |
--arg jam "${JAM_VERSION}" \ | |
--arg syft "${SYFT_VERSION}" \ | |
'{ pack: $pack, jam: $jam, syft: $syft }' > ./stack/scripts/.util/tools.json | |
- name: Commit | |
id: commit | |
uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main | |
with: | |
message: "Updating tools" | |
pathspec: "." | |
keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }} | |
key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }} | |
- name: Push Branch | |
if: ${{ steps.commit.outputs.commit_sha != '' }} | |
uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main | |
with: | |
branch: automation/tools/update | |
- name: Open Pull Request | |
if: ${{ steps.commit.outputs.commit_sha != '' }} | |
uses: paketo-buildpacks/github-config/actions/pull-request/open@main | |
with: | |
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} | |
title: "Updates tools" | |
branch: automation/tools/update | |
failure: | |
name: Alert on Failure | |
runs-on: ubuntu-22.04 | |
needs: [update] | |
if: ${{ always() && needs.update.result == 'failure' }} | |
steps: | |
- name: File Failure Alert Issue | |
uses: paketo-buildpacks/github-config/actions/issue/file@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repo: ${{ github.repository }} | |
label: "failure:update-tools" | |
comment_if_exists: true | |
issue_title: "Failure: Update Tools workflow" | |
issue_body: | | |
Update Tools workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). | |
comment_body: | | |
Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} |