Daily check #291
This file contains hidden or 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: Daily check | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Every Day at 10AM | |
| - cron: '0 10 * * *' | |
| jobs: | |
| check-kubectl-new-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| actions: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| # Fine-grained PAT with contents:write and workflows:write | |
| # scopes | |
| token: ${{ secrets.WORKFLOW_TOKEN }} | |
| - name: Get latest tag from the repository | |
| id: repository | |
| run: echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
| - name: Get latest kubectl release | |
| id: remote | |
| run: echo "version=$(curl https://cdn.dl.k8s.io/release/stable.txt)" >> $GITHUB_OUTPUT | |
| - name: Debug outputs | |
| run: | | |
| echo "Repository version: ${{ steps.repository.outputs.version }}" | |
| echo "Remote version: ${{ steps.remote.outputs.version }}" | |
| - name: Create new tag | |
| if: ${{ steps.repository.outputs.version != steps.remote.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| git config user.name "Github Actions" | |
| git config user.email 'github-actions@users.noreply.github.com' | |
| git tag -a "${{ steps.remote.outputs.version }}" -m "New release" | |
| git push origin "${{ steps.remote.outputs.version }}" |