mirror of
https://github.com/LamGC/jenkins-agent-with-docker.git
synced 2025-04-30 06:37:29 +00:00
初步添加一个更新检测工作流。
This commit is contained in:
parent
d8c727b414
commit
0a2f15827e
34
.github/workflows/check-updates.yml
vendored
Normal file
34
.github/workflows/check-updates.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
name: Build container image
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# 检查 jenkinsci/docker-inbound-agent 仓库的最新版本,并将最新版本写入到 LATEST_VERSION 文件中
|
||||||
|
check-updates:
|
||||||
|
timeout-minutes: 5
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Check updates
|
||||||
|
uses: actions/github-script@v5
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { data: { tag_name: latestVersion } } = await github.repos.getLatestRelease({
|
||||||
|
owner: 'jenkinsci',
|
||||||
|
repo: 'docker-inbound-agent',
|
||||||
|
});
|
||||||
|
await github.repos.createOrUpdateFileContents({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
path: 'LATEST_VERSION',
|
||||||
|
message: `Update LATEST_VERSION to ${latestVersion}`,
|
||||||
|
content: Buffer.from(latestVersion).toString(),
|
||||||
|
sha: context.sha,
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user