diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml new file mode 100644 index 0000000..1cdacc4 --- /dev/null +++ b/.github/workflows/check-updates.yml @@ -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, + }); \ No newline at end of file