debugging in public, once again. #1
This file contains hidden or 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 Retype Version' | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| schedule: | |
| # posix time format | |
| # minute, hour, day of month, day of year, day of week (1 == Monday) | |
| # 3:00 UTC every Monday - once a week | |
| - cron: '0 3 * * 1' | |
| jobs: | |
| update-retype: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # write permissions required for creating pull requests | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get latest Retype version | |
| id: get_version | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const release = await github.rest.repos.getLatestRelease({ | |
| owner: 'retypeapp', | |
| repo: 'retype' | |
| }); | |
| const version = release.data.tag_name.replace(/^v/, ''); | |
| console.log(`Latest Retype version is ${version}`); | |
| return version; | |
| result-encoding: string | |
| - name: Update JSON file | |
| run: | | |
| JSON_FILE=".devcontainer/devcontainer.json" | |
| # The latest version from the previous step | |
| LATEST_VERSION="${{ steps.get_version.outputs.result }}" | |
| jq '.image = "retypeapp/retype:$LATEST_VERSION"' $JSON_FILE > tmp.$$.json && mv tmp.$$.json $JSON_FILE | |
| - name: Create Pull Request for retype version update | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: 'Bot: update retype to version ${{ steps.get_version.outputs.result }}' | |
| title: 'Update Retype to v${{ steps.get_version.outputs.result }}' | |
| body: | | |
| Auto-generated by [retype-version-update.yml] | |
| branch: 'chore/update-retype' | |
| delete-branch: true |