From baa7cacb05f7768f9482ef3885a522b2907f5d93 Mon Sep 17 00:00:00 2001 From: kaanyagci Date: Sun, 11 Aug 2024 22:32:06 +0200 Subject: [PATCH] chore(gha/workflows): add new workflow to get the latest skaffold.yaml version Signed-off-by: kaanyagci --- .../workflows/get_latest_skaffold_version.yml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/get_latest_skaffold_version.yml diff --git a/.github/workflows/get_latest_skaffold_version.yml b/.github/workflows/get_latest_skaffold_version.yml new file mode 100644 index 0000000..b87b3f3 --- /dev/null +++ b/.github/workflows/get_latest_skaffold_version.yml @@ -0,0 +1,45 @@ +name: Update Version + +permissions: + contents: write + actions: write + +on: + schedule: + - cron: '0 0 * * *' # Runs every hour (adjust as needed) + workflow_dispatch: # Allows manual trigger of the workflow + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - name: Checkout current repository + uses: actions/checkout@v3 + + - name: Checkout external repository with depth 1 + uses: actions/checkout@v3 + with: + repository: GoogleContainerTools/skaffold # External repository + path: external-repo + ref: main # Replace with the branch name if different + fetch-depth: 1 # Only fetch the latest commit + + - name: Parse version from markdown file + id: parse_version + run: | + version=$(grep -Eo "\-\-version='skaffold/(v[0-9a-zA-Z]+)'" external-repo/docs-v2/content/en/docs/references/cli/_index.md | sed -E "s/--version='skaffold\/(v[0-9a-zA-Z]+)'/\1/") + echo "VERSION=$version" >> $GITHUB_ENV + - name: Update GitHub CLI + run: | + sudo apt-get update + sudo apt-get install -y gh + + - name: Check gh CLI version + run: gh --version + + - name: Authenticate GitHub CLI + run: gh auth login --with-token <<< ${{ secrets.ADMIN_PAT }} + + - name: Update GitHub Secret + run: | + gh variable set SKAFFOLD_YAML_VERSION --body "$VERSION" --repo ${{ github.repository }} \ No newline at end of file