Synchronize Rakudo Star with the latest Rakudo release #316
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
# See https://stackoverflow.com/questions/58465057/trigger-a-github-action-when-another-repository-creates-a-new-release | |
# | |
# This Action works only because of the available "build_rakudo-star.yml" Action. | |
## Actually this here triggers the other build Action by adding a new TAG (Rakudo releases are having TAGs) | |
## TODO: switch to env vars later | |
name: Synchronize Rakudo Star with the latest Rakudo release | |
on: | |
schedule: # Mondays and Thursdays, at 23:55 UTC | |
- cron: '55 23 * * 1,4' | |
workflow_dispatch: | |
env: | |
RKD_REVISION: "01" # Change this if a build revision ever changes. | |
jobs: | |
synchronize_star_release_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the latest Rakudo release version | |
id: rakudo-release | |
run: | | |
echo ::set-output name=release::$(curl -v --stderr - https://github.com/rakudo/rakudo/releases/latest | grep -i "location: " | grep -Po "(\d+\.\d+)(\\.[0-9]+)?") | |
- name: Check the latest Rakudo Star release version | |
id: star-release | |
run: | | |
echo ::set-output name=release::$(curl -v --stderr - https://github.com/rakudo/star/releases/latest | grep -i "location: " | grep -Po "(\d+\.\d+)(\\.[0-9]+)?") | |
- name: Show the found Rakudo releases | |
run: | | |
echo "Rakudo latest is: ${{ steps.rakudo-release.outputs.release }}" | |
echo "Rakudo Star latest is: ${{ steps.star-release.outputs.release }}" | |
- name: Compare the latest Rakudo and Rakudo Star releases | |
id: update-star-release | |
if: (steps.rakudo-release.outputs.release && steps.star-release.outputs.release && (steps.rakudo-release.outputs.release != steps.star-release.outputs.release)) | |
run: echo ::set-output name=update_star_release::'true' | |
- name: Checkout Rakudo Star repository | |
if: steps.update-star-release.outputs.update_star_release | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ACTIONS_RAKUDO_SYNC }} | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Update the RSTAR core component versions in /etc/fetch_core.txt | |
if: steps.update-star-release.outputs.update_star_release | |
run: | | |
ls -lad * | |
for RSTAR_COMPONENT in moarvm_version nqp_version rakudo_version; do | |
sed -i -r s#$RSTAR_COMPONENT\=\([0-9]\)\+.\([0-9]\)\+\(.[0-9]\)?#$RSTAR_COMPONENT=${{ steps.rakudo-release.outputs.release }}# etc/fetch_core.txt | |
done | |
- name: Write the Release version | |
if: steps.update-star-release.outputs.update_star_release | |
run: echo "${{ steps.rakudo-release.outputs.release }}" "===>" $(date) > RELEASE | |
- name: Publish latest Rakudo Star release | |
if: steps.update-star-release.outputs.update_star_release | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Following the https://github.com/rakudo/rakudo/ release cycle, see https://github.com/rakudo/rakudo/releases/tag/${{ steps.rakudo-release.outputs.release }} for release informations" | |
tag: "${{ steps.rakudo-release.outputs.release }}" | |
push: "true" |