Fix Release.yml #2
Workflow file for this run
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: "Publish Release" | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Name of the branch to create the tag from' | |
required: true | |
default: 'main' | |
push: | |
env: | |
tarballs_dir: ./build/tarballs | |
jobs: | |
release: | |
name: "Publish Pre-Release" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Needed determine latest tag | |
- name: Get Latest Tag | |
id: latest_tag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
# TODO: in future we might need to perform backports, at which point we'll need to check | |
# that the project.version has not already been tagged | |
- name: Check for updated Project version | |
id: project_toml | |
shell: julia --color=yes --project {0} | |
env: | |
LATEST_TAG: ${{ steps.latest_tag.outputs.tag }} | |
run: | | |
using Pkg.Types | |
project = read_project("Project.toml") | |
latest_tag = parse(VersionNumber, ENV["LATEST_TAG"]) | |
@info "Project version: project.version" | |
@info "Latest tag: latest_tag" | |
project.version > latest_tag || exit(1) # error if can't make a tag | |
open(ENV["GITHUB_OUTPUT"], "a") do io | |
println(io, "version=$(project.version)") | |
println(io, "tag=v$(project.version)") | |
end | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
id: download-artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
branch: $BRANCH | |
name: ray_julia_libraries | |
path: ${{ env.tarballs_dir }} | |
- uses: julia-actions/setup-julia@v1 | |
with: | |
version: "1.8" | |
arch: "x64" | |
- uses: julia-actions/cache@v1 | |
- name: Update Artifacts.toml | |
shell: julia --color=yes --project {0} | |
run: | | |
using Pkg | |
Pkg.instantiate() | |
include(joinpath(pwd(), "bind_artifacts.jl")) | |
bind_artifacts() | |
working-directory: ${{ env.build_dir }} | |
- name: Commit Changes | |
id: commit | |
run: | | |
# Alternatively environment variables can be used but both author/committer need to be set | |
# https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing | |
git config user.name beacon-buddy | |
git config user.email beacon-buddy@beacon.bio | |
msg="Update Artifacts.toml to use ${{ steps.project_toml.outputs.version }} assets" | |
git checkout --detach | |
git commit -m "$msg" -- Artifacts.toml | |
echo "sha=$(git rev-parse HEAD)" | tee -a "$GITHUB_OUTPUT" | |
- name: Tag and push | |
run: | | |
tag=${{ steps.project_toml.outputs.tag }} | |
git tag $tag ${{ steps.commit.outputs.sha }} | |
git push origin $tag | |
- name: Publish Pre-Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
tag_name: ${{ steps.project_toml.outputs.tag }} | |
target_commitish: ${{ steps.commit.outputs.sha }} | |
generate_release_notes: true | |
files: ${{ env.tarballs_dir }}/*.tar.gz |