0

I would like write a script that automatically fetches the latest Neovim Appimage from the releases page, I was trying to see if I can use wget to access the latest appimage, but that would require me to know the latest version before running the command (if I wanted to create the URL myself).

e.g. https://github.com/neovim/neovim/releases/download/v0.6.1/nvim.appimage

Is there a way to do this? I'd also like to fetch the sha256sums along with the appimage as well (so a general method to download the latest assets also works).

1
  • I have a script with nightly.
    – eyal karni
    Jan 16 at 1:04

1 Answer 1

0

I found that the url https://github.com/neovim/neovim/releases/latest automatically redirects to the latest version URL. So I wrote a script that extracts the version and downloads the assets.

As long as the neovim team doesn't modify their repo paths, it should keep working:

nvim_latest_version=$(curl -s https://github.com/neovim/neovim/releases/latest | grep -Po '".*"' )                                                                                                         
# get version                                                                                                                                                                                              
nvim_latest_version="${nvim_latest_version:47:-1}"                                                                                                                                                         
# get download link                                                                                                                                                                                        
nvim_base_download_link=https://github.com/neovim/neovim/releases/download/${nvim_latest_version}                                                                                                          
# append assets                                                                                                                                                                                            
nvim_appimage_link=$nvim_base_download_link/nvim.appimage                                                                                                                                                  
nvim_appimage_checksum_link=$nvim_base_download_link/nvim.appimage.sha256sum                                                                                                                               
nvim_linux64_link=$nvim_base_download_link/nvim-linux64.tar.gz                                                                                                                                             
nvim_linux64_checksum_link=$nvim_base_download_link/nvim-linux64.tar.gz.sha256sum                                                                                                                          
# download                                                                                                                                                                                                 
wget $nvim_appimage_link                                                                                                                                                                                   
wget $nvim_appimage_checksum_link                                                                                                                                                                          
wget $nvim_linux64_link                                                                                                                                                                                    
wget $nvim_linux64_checksum_link                                                                                                                                                                           
# check shasums                                                                                                                                                                                            
sha256sum -c nvim.appimage.sha256sum                                                                                                                                                                       
sha256sum -c nvim-linux64.tar.gz.sha256sum

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.