update to ss3sim repo in .yml in create pull request step; #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
# This updates the ss3sim binaries and bumps the version | ||
# according to file names and specification in the ss3sim | ||
# and ssmse. | ||
# Note that this should only be run manually for now when | ||
# there are definitely updates, as the version number will | ||
# be changed if the workflow is run, even if there is no | ||
# change to the executables. | ||
# See additional documentation on versioning in a comment | ||
# later in the workflow. | ||
name: Update SS3 version in R package | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
jobs: | ||
update-ss3-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Git repository | ||
uses: actions/checkout@v3 | ||
- name: Get the latest stock synthesis binaries | ||
run: | | ||
curl https://api.github.com/repos/nmfs-stock-synthesis/stock-synthesis/releases/latest | grep "browser_download_url" | grep -Eo 'https://[^\"]*' | xargs wget | ||
- name: Get the link to the latest release (including version number) | ||
id: get-link-to-release | ||
run: | | ||
link_to_release=$(curl https://api.github.com/repos/nmfs-stock-synthesis/stock-synthesis/releases/latest | grep "html_url" | grep 'releases' | grep -Eo 'https://[^\"]*') | ||
release_digits=$(echo "${link_to_release}" | sed 's/https\:\/\/github\.com\/nmfs-stock-synthesis\/stock-synthesis\/releases\/tag\/v3\.30\.//') | ||
echo "link_to_release=${link_to_release}" >> $GITHUB_OUTPUT | ||
echo "release_digits=${release_digits}" >> $GITHUB_OUTPUT | ||
# Note on versioning in ss3sim and SSMSE: | ||
# x.yy.z where yy is the "patch" version of the SS3.30 executable, | ||
# e.g., ss3sim will be 1.19.0. This will allow the patch version of {ss3sim} | ||
# to increment while 1.19 will stay the same while we are using SS3.30.19. | ||
# That way users can always know what version of Stock Synthesis is being | ||
# referenced without needing to run the executable. Thus, major version is for | ||
# "major" breaking changes in {ss3sim}, "minor" matches the "patch" version of | ||
# SS3 being used, and "patch" is for small changes to {ss3sim} while using a | ||
# given version of SS3. | ||
- name: Bump version using sed. Match SS3 version followed by 0 | ||
run: | | ||
sed -r -i 's/(Version: ?[0-9]+\.)([0-9]+\.[0-9+])/echo "\1${{ steps.get-link-to-release.outputs.release_digits }}.0"/ge' DESCRIPTION | ||
- name: Move exes to the right location | ||
run: | | ||
mv ss_linux inst/bin/Linux64/ss | ||
mv ss_win.exe inst/bin/Windows64/ss.exe | ||
mv ss_osx inst/bin/MacOS/ss | ||
rm ss_opt_osx | ||
rm ss_opt_linux | ||
rm ss_opt_win.exe | ||
- name: Change permissions for mac and linux exes | ||
run: | | ||
chmod a+x inst/bin/Linux64/ss | ||
chmod a+x inst/bin/MacOS/ss | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: | | ||
Update ss3 binaries | ||
From ${{ steps.get-link-to-release.outputs.link_to_release }} | ||
branch: update-ss3 | ||
title: 'Update ss3 binaries' | ||
body: | | ||
Auto-generated by [update-ss3-version.yml][1]. Binaries from ${{ steps.get-link-to-release.outputs.link_to_release }}. | ||
# [1]: https://github.com/ss3sim/ss3sim/tree/main/.github/workflows/update-ss3-version.yml | ||
[1]: https://github.com/ss3sim/ss3sim/tree/transfer-workflow/.github/workflows/update-ss3-version.yml |