Watch #366
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: Watch | |
| on: | |
| schedule: | |
| - cron: '30 */4 * * *' | |
| jobs: | |
| docker: | |
| name: Push tagged docker image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: master | |
| - name: Update Dockerfile with latest version | |
| id: fetch_version | |
| run: | | |
| last=$(curl -s https://packagist.org/packages/vimeo/psalm.json|jq '[.package.versions[]|select(.version|test("^\\d+\\.\\d+\\.\\d+$"))|.version]|max_by(.|[splits("[.]")]|map(tonumber))') | |
| last=$(echo $last | tr -d '"') | |
| echo "Last Psalm version is $last" | |
| echo ::set-output name=last::$last | |
| sed -i -re "s/require vimeo\/psalm/require vimeo\/psalm:$last/" Dockerfile | |
| cat Dockerfile | |
| - name: Docker login | |
| run: echo '${{ secrets.DOCKER_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
| - name: Build images | |
| run: docker build -t vimeo/psalm-github-actions:${{ steps.fetch_version.outputs.last }} . | |
| - name: Publish | |
| run: docker push vimeo/psalm-github-actions:${{ steps.fetch_version.outputs.last }} |