Skip to content

Revert "remove DOCUMENTER_KEY from git tag stage" #16

Revert "remove DOCUMENTER_KEY from git tag stage"

Revert "remove DOCUMENTER_KEY from git tag stage" #16

Workflow file for this run

name: "Publish Pre-Release"
on:
workflow_dispatch:
inputs:
commit:
# Note: The tag itself will not be based off this commit. As we must first commit the
# updates to the Artifacts.toml, then the tag will be based off that commit.
description: The commit to branch from when making the tag
required: true
push:
# Force a single workflow to run at a time. This ensures we don't accidentally
# try to perform concurrent publishing of releases.
concurrency: publish-release
env:
build_dir: ./build
tarballs_dir: ./build/tarballs
jobs:
release:
name: "Publish Pre-Release"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed determine tags
persist-credentials: false # Avoid using these credentials as pushing new commits doesn't re-trigger CI jobs
ref: ${{ inputs.commit }}
- name: Check for new Project version
id: project_toml
shell: julia --color=yes --project {0}
run: |
using Pkg.Types
project = read_project("Project.toml")
tags = parse.(VersionNumber, split(readchomp(`git tag -l`), "\n"))
@info "Project version: project.version"
project.version in tags && error("Tag v$(project.version) already exists")
open(ENV["GITHUB_OUTPUT"], "a") do io
println(io, "version=$(project.version)")
println(io, "tag=v$(project.version)")
end
- name: Download artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
commit: ${{ inputs.commit }} # pull the artifacts for the given commit
name: ray_julia_libraries
path: ${{ env.tarballs_dir }}
workflow: CI.yml
- uses: julia-actions/setup-julia@v1
with:
version: "1.8"
arch: "x64"
- uses: julia-actions/cache@v1
with:
cache-name: "${{ github.workflow }}-${{ github.job }}"
- 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 and Push Tag
id: commit
env:
# Avoid using the workflows GITHUB_TOKEN as it will not re-trigger CI jobs
# https://github.community/t/push-from-action-does-not-trigger-subsequent-action/16854
GITHUB_TOKEN: ${{ secrets.DOCUMENTER_KEY }}
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 [email protected]
# Commit changes
msg="Update Artifacts.toml to use ${{ steps.project_toml.outputs.version }} assets"
git checkout --detach
git commit -m "$msg" -- Artifacts.toml
# Push Tag
tag=${{ steps.project_toml.outputs.tag }}
git tag $tag
git push origin $tag
- name: Publish Pre-Release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.DOCUMENTER_KEY }}
with:
prerelease: true
tag: ${{ steps.project_toml.outputs.tag }}
artifacts: ${{ env.tarballs_dir }}/*.tar.gz
generateReleaseNotes: true