-
-
Save sairus7/f5e827270dd1789645415e7f2ec84a7e to your computer and use it in GitHub Desktop.
Update version for Julia registry, tag, release
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: Update version for Julia registry, tag, release | |
on: | |
push: | |
branches: [master] | |
jobs: | |
if_merged: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read version and check tags | |
shell: bash | |
id: version | |
run: | | |
git fetch --tags origin | |
ver_num=v$(grep -oP 'version = "\K[^"]+' "Project.toml") | |
old_ver="$(git tag -l $ver_num)" | |
if [[ $old_ver ]]; then is_old_ver="true"; else is_old_ver="false"; fi | |
echo "old_ver=$old_ver" | |
echo "ver_num=$ver_num" | |
echo "is_old_ver=$is_old_ver" | |
echo "ver_num=$ver_num" >> $GITHUB_OUTPUT | |
echo "is_old_ver=$is_old_ver" >> $GITHUB_OUTPUT | |
- if: steps.version.outputs.is_old_ver == 'false' | |
name: Configure Github Credentials | |
shell: bash | |
run: | | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
echo '${{ secrets.MY_SSH_PRIVATE_KEY }}' > ~/.ssh/id_rsa | |
ssh-keyscan github.com > ~/.ssh/known_hosts | |
chmod 600 ~/.ssh/id_rsa ~/.ssh/known_hosts | |
- if: steps.version.outputs.is_old_ver == 'false' | |
name: Configure git | |
run: | | |
git config --global user.email "github_action@my.org" | |
git config --global user.name "GitHub Action" | |
- if: steps.version.outputs.is_old_ver == 'false' | |
uses: julia-actions/setup-julia@v1 | |
with: | |
version: 1 | |
arch: ${{ runner.arch }} | |
- if: steps.version.outputs.is_old_ver == 'false' | |
name: Update Julia local registry | |
run: | | |
using Pkg | |
ENV["JULIA_PKG_SERVER"] = "" | |
ENV["JULIA_PKG_USE_CLI_GIT"] = true | |
Pkg.add("LocalRegistry") | |
using LocalRegistry | |
try | |
register(;registry="git@github.com:MyOrg/JuliaRegistry.git") | |
catch e | |
@error e | |
end | |
shell: julia --color=yes {0} | |
- if: steps.version.outputs.is_old_ver == 'false' | |
name: Publish release | |
id: release-snapshot | |
uses: softprops/action-gh-release@v1 | |
with: | |
# token: ${{ secrets.MY_RELEASE_TOKEN }} # optional PAT to be able to trigger other workflows | |
tag_name: ${{ steps.version.outputs.ver_num }} | |
draft: false | |
prerelease: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment