Skip to content

Adding workflow to update binary builder and Julia version #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/release_and_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Release and Update Dependencies

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get latest tag
id: get-latest-tag
run: |
latest_tag=$(git describe --tags --abbrev=0 || echo "v0.1.0")
echo "latest_tag=$latest_tag" >> $GITHUB_ENV

- name: Increment version
id: bump-version
run: |
IFS='.' read -ra parts <<< "${{ env.latest_tag }}"
new_patch=$(( ${parts[2]} + 1 ))
new_version="v${parts[0]}.${parts[1]}.$new_patch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only bumps the point version. I think we can do a release manually, and trigger a workflow when we have a new release. See how we publish mmtk-core to crates.io when we tag a release: https://github.com/mmtk/mmtk-core/blob/4ca8812607bfb0b398278e01cbd3755959c7d010/.github/workflows/cargo-publish.yml#L6

echo "new_version=$new_version" >> $GITHUB_ENV

- name: Create new GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.new_version }}
generate_release_notes: true

update-yggdrasil:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get latest commit hash
id: get-hash
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Open PR to Yggdrasil
id: create-yggdrasil-pr
run: |
gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}"
gh repo clone JuliaPackaging/Yggdrasil
cd Yggdrasil
branch_name="update-mmtk-julia-${{ env.commit_hash }}"
git checkout -b "$branch_name"
sed -i "10s/hash = \".*\"/hash = \"${{ env.commit_hash }}\"/" M/mmtk_julia/build_tarballs.jl
git commit -am "Update MMTK Julia hash"
git push origin "$branch_name"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a branch in JuliaPackaging/Yggdrasil. Do we have permission to do that? If we do, we need to set up the token in the first step using a token that has permission to push to the repo.

Alternatively, we can use the mmtk bot account, and push to its own fork of Yggdrasil and open a PR.

pr_url=$(gh pr create --title "Update MMTK Julia hash" --body "Auto-generated PR to update MMTK Julia hash." --base master --head "$branch_name")
echo "pr_url=$pr_url" >> $GITHUB_ENV
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT

update-julia:
needs: update-yggdrasil
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get latest commit hash
id: get-hash
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Get Yggdrasil PR URL
run: echo "yggdrasil_pr=${{ needs.update-yggdrasil.outputs.pr_url }}" >> $GITHUB_ENV

- name: Open PR to JuliaLang/julia
run: |
gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}"
gh repo clone JuliaLang/julia
cd julia
branch_name="update-mmtk-julia-${{ env.commit_hash }}"
git checkout -b "$branch_name"
sed -i "s/MMTK_JULIA_SHA1 = \".*\"/MMTK_JULIA_SHA1 = \"${{ env.commit_hash }}\"/" deps/mmtk_julia.version
sed -i "s/MMTK_JULIA_TAR_URL = \".*\"/MMTK_JULIA_TAR_URL = \"v${{ env.new_version }}.tar.gz\"/" deps/mmtk_julia.version
git commit -am "Update MMTK Julia references"
git push origin "$branch_name"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. This push to a branch in JuliaLang/julia. We need to know if we have permission to do so. Even if we do have permission, we probably still want to push to a fork and open a PR.

gh pr create --title "Update MMTK Julia references" --body "TODO: update the MMTK_JULIA_JLL_VER after the [BinaryBuilder PR](${{ env.yggdrasil_pr }}) gets merged." --base master --head "$branch_name"
Loading