-
Notifications
You must be signed in to change notification settings - Fork 5
45 lines (41 loc) · 1.44 KB
/
daily-release.yml
File metadata and controls
45 lines (41 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 }}"