Renew configs #21
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: Renew configs | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
check_release: | |
runs-on: ubuntu-latest | |
outputs: | |
skip: ${{ steps.release.outputs.skip }} | |
version: ${{ steps.gear_release.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Last gear release | |
id: gear_release | |
run: | | |
VERSION=$(curl -s https://api.github.com/repos/gear-tech/gear/releases/latest | jq -r '.tag_name') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Last rosetta release | |
id: rosetta_release | |
run: | | |
VERSION=$(curl -s https://api.github.com/repos/gear-foundation/integrations-rosetta-api/releases/latest | jq -r '.tag_name') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Compare versions | |
id: release | |
run: | | |
if [ ${{ steps.gear_release.outputs.version }} == ${{ steps.rosetta_release.outputs.version }} ]; then | |
echo "No new version to release" | |
echo "skip=true" >> $GITHUB_OUTPUT | |
else | |
echo "New version to release" | |
echo "skip=false" >> $GITHUB_OUTPUT | |
fi | |
create_pr: | |
runs-on: ubuntu-latest | |
needs: check_release | |
if: needs.check_release.outputs.skip != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: "Install NodeJS 20.x" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: "Update metadata" | |
run: | | |
node ./scripts/renew-config.js "${{ needs.check_release.outputs.version }}" | |
- name: "Update pkg version" | |
run: | | |
sed -i "s/\"version\": \".*\"/\"version\": \"${{ needs.check_release.outputs.version }}\"/g" package.json | |
- name: Create Pull Request if not exist | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
add-paths: | | |
config/* | |
commit-message: add new vara config | |
branch: "renew-configs" | |
branch-suffix: timestamp | |
delete-branch: true | |
base: master | |
title: "[Automated] ${{ needs.check_release.outputs.version }}" | |
body: | | |
"Automated renew configs for version ${{ needs.check_release.outputs.version }}" | |
draft: false | |
reviewers: osipov-mit |