Update build to include the latest pkl releases #196
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 build to include the latest pkl releases | |
| 'on': | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| schedule: | |
| - cron: 0 13 * * 1 | |
| workflow_dispatch: {} | |
| jobs: | |
| get-current-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| current-version: ${{ env.PKL_VERSION }} | |
| latest-version: ${{ steps.cleaned-tool-release.outputs.release }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get current latest supported pkl version | |
| run: |- | |
| mapfile -t pklversions < "pkl-versions" | |
| echo "PKL_VERSION=${pklversions[-1]}" >> $GITHUB_ENV | |
| - id: tool-release | |
| name: Get latest pkl version | |
| uses: pozetroninc/github-action-get-latest-release@master | |
| with: | |
| owner: apple | |
| repo: pkl | |
| excludes: prerelease, draft | |
| - id: cleaned-tool-release | |
| name: Strip leading "v" from the version string | |
| run: |- | |
| latestVersion="${{ steps.tool-release.outputs.release }}" | |
| echo "release=${latestVersion##*v}" >> $GITHUB_OUTPUT | |
| - name: Job Summary | |
| run: |- | |
| echo "### Versions" >> $GITHUB_STEP_SUMMARY | |
| echo "Current version: ${{ env.PKL_VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "Latest version: ${{ steps.pkl-release.outputs.release }}" >> $GITHUB_STEP_SUMMARY | |
| update-pkl-version: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| needs: | |
| - get-current-version | |
| if: needs.get-current-version.outputs.current-version != needs.get-current-version.outputs.latest-version && github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update pkl-versions file with last 10 releases | |
| run: |- | |
| mapfile -t pklversions < "pkl-versions" | |
| pklversions+=("${{ needs.get-current-version.outputs.latest-version }}") | |
| start_index=$(( ${#pklversions[@]} > 10 ? ${#pklversions[@]} - 10 : 0 )) | |
| printf "%s\n" "${pklversions[@]:$start_index}" > pkl-versions | |
| - name: Setup node for gomplate | |
| uses: actions/setup-node@v4 | |
| - name: Update README and entrypoints | |
| run: |- | |
| npm install -g gomplate | |
| ./render-templates.sh | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| branch: update-pkl/feature/${{ needs.get-current-version.outputs.latest-version }}-pkl-lang | |
| title: Update pkl from ${{ needs.get-current-version.outputs.current-version }} to ${{ needs.get-current-version.outputs.latest-version }} | |
| assignees: emilymclean | |
| reviewers: emilymclean | |
| token: ${{ secrets.WORKER_PAT }} | |
| keep-alive: | |
| permissions: | |
| actions: write | |
| if: github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: liskin/gh-workflow-keepalive@v1 |