Sync Deno Releases #25837
This file contains 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: Sync Deno Releases | |
on: | |
schedule: | |
- cron: '*/30 * * * *' | |
workflow_dispatch: | |
jobs: | |
sync_releases: | |
name: "Sync release versions between `denoland/deno` and `deno911/arm64`" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Compare latest releases | |
shell: bash | |
run: | | |
get_latest_github_release() { | |
local url="https://api.github.com/repos/${1}/releases/latest" | |
curl -s -H "Accept: application/json" "$url" | jq -r '.tag_name' | |
} | |
DENOLAND_VERSION=$(get_latest_github_release "denoland/deno") | |
DENO911_VERSION=$(get_latest_github_release "deno911/arm64") | |
echo "denoland/deno version: $DENOLAND_VERSION" | |
echo "deno911/arm64 version: $DENO911_VERSION" | |
if [[ "$DENOLAND_VERSION" != "$DENO911_VERSION" ]]; then | |
echo "release_version=$DENOLAND_VERSION" >> $GITHUB_ENV | |
fi | |
- name: Release | |
uses: actions/github-script@v6 | |
if: ${{ env.release_version }} | |
with: | |
script: | | |
// Create a new release in deno911/arm64 that matches the denoland/deno release. | |
await github.rest.repos.createRelease({ | |
name: "${{ env.release_version }}", | |
tag_name: "${{ env.release_version }}", | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "[${{ env.release_version }}](https://github.com/denoland/deno/releases/tag/${{ env.release_version }})" | |
}); | |
// Trigger a build job to create an ARM binary and Docker image for the new release | |
// Apparently using the API to create a release does not trigger jobs with on.release.[created] triggers. | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: "build-deno.yaml", | |
ref: "main", | |
inputs: { | |
version: "${{ env.release_version }}" | |
} | |
}); | |