mirror of
https://github.com/LamGC/jenkins-agent-with-docker.git
synced 2025-04-29 22:27:31 +00:00
改用脚本来检查了,一脚踢开 github-scripts。
This commit is contained in:
parent
12deafa8ec
commit
826c7d738d
27
.github/workflows/check-updates.yml
vendored
27
.github/workflows/check-updates.yml
vendored
@ -9,26 +9,19 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# 检查 jenkinsci/docker-inbound-agent 仓库的最新版本,并将最新版本写入到 LATEST_VERSION 文件中
|
# 检查 jenkinsci/docker-inbound-agent 仓库的最新版本,并使用 actions/github-script 向 LATEST_VERSION 文件写入最新版本号。
|
||||||
check-updates:
|
check-updates:
|
||||||
timeout-minutes: 5
|
timeout-minutes: 30
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Check updates
|
- name: Check updates
|
||||||
uses: actions/github-script@v5
|
run: chmod +x ./update-version.sh && ./update-version.sh
|
||||||
|
- name: Commit changes
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
script: |
|
commit_message: Update LATEST_VERSION
|
||||||
const { data: { tag_name: latestVersion } } = await github.repos.getLatestRelease({
|
commit_options: '--no-verify'
|
||||||
owner: 'jenkinsci',
|
file_pattern: LATEST_VERSION
|
||||||
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,
|
|
||||||
});
|
|
4
update-version.sh
Normal file
4
update-version.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
LATEST_VERSION=$(curl -s https://api.github.com/repos/jenkinsci/docker-inbound-agent/releases/latest | grep tag_name | cut -d '"' -f 4)
|
||||||
|
if [ "$LATEST_VERSION" != "$(cat LATEST_VERSION)" ]; then
|
||||||
|
echo "$LATEST_VERSION" > LATEST_VERSION
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user