2022-04-13 17:08:04 +00:00
|
|
|
name: PR for latest Syft release
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: "0 8 * * *" # 3 AM EST
|
|
|
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
2023-09-07 18:55:38 +00:00
|
|
|
GO_VERSION: "1.21.x"
|
2022-04-13 17:08:04 +00:00
|
|
|
GO_STABLE_VERSION: true
|
|
|
|
|
2022-11-14 13:10:09 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-04-13 17:08:04 +00:00
|
|
|
jobs:
|
|
|
|
upgrade-syft:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.repository == 'anchore/grype' # only run for main repo
|
|
|
|
steps:
|
2023-10-18 17:50:51 +00:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2022-04-13 17:08:04 +00:00
|
|
|
|
2023-12-11 11:40:01 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2022-04-13 17:08:04 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
stable: ${{ env.GO_STABLE_VERSION }}
|
|
|
|
|
2023-04-03 14:28:53 +00:00
|
|
|
- name: Get latest Syft version
|
|
|
|
id: latest-version
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
|
|
|
LATEST_VERSION=$(gh release view --json name -q '.name' -R anchore/syft)
|
2022-04-13 17:08:04 +00:00
|
|
|
|
|
|
|
# update go.mod
|
|
|
|
go get github.com/anchore/syft@$LATEST_VERSION
|
2022-04-13 20:30:53 +00:00
|
|
|
go mod tidy
|
2022-04-13 17:08:04 +00:00
|
|
|
|
|
|
|
# export the version for use with create-pull-request
|
2023-04-03 13:36:18 +00:00
|
|
|
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_OUTPUT
|
2022-04-13 17:08:04 +00:00
|
|
|
|
2023-09-20 20:39:49 +00:00
|
|
|
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
|
2022-04-13 17:08:04 +00:00
|
|
|
id: generate-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.TOKEN_APP_ID }}
|
|
|
|
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
|
|
|
|
|
2023-06-14 19:58:43 +00:00
|
|
|
- uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
|
2022-04-13 17:08:04 +00:00
|
|
|
with:
|
|
|
|
signoff: true
|
|
|
|
delete-branch: true
|
2023-03-21 15:09:10 +00:00
|
|
|
branch: auto/latest-syft
|
2022-04-13 17:08:04 +00:00
|
|
|
labels: dependencies
|
2023-03-21 15:09:10 +00:00
|
|
|
commit-message: "chore(deps): update Syft to ${{ steps.latest-version.outputs.LATEST_VERSION }}"
|
|
|
|
title: "chore(deps): update Syft to ${{ steps.latest-version.outputs.LATEST_VERSION }}"
|
2022-04-13 17:08:04 +00:00
|
|
|
body: |
|
|
|
|
Update Syft to ${{ steps.latest-version.outputs.LATEST_VERSION }}
|
|
|
|
token: ${{ steps.generate-token.outputs.token }}
|