-
Notifications
You must be signed in to change notification settings - Fork 33
46 lines (38 loc) · 1.41 KB
/
watch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Watch
on:
workflow_dispatch:
schedule:
- cron: '30 */4 * * *'
jobs:
docker:
name: Push tagged docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
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 "last=$last" >> $GITHUB_OUTPUT
sed -i -re "s/require vimeo\/psalm/require vimeo\/psalm:$last/" Dockerfile
cat Dockerfile
- name: Docker login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images
run: docker build -t ghcr.io/psalm/psalm-github-actions:${{ steps.fetch_version.outputs.last }} -t ghcr.io/psalm/psalm-github-actions:latest .
- name: Publish
run: |
docker push ghcr.io/psalm/psalm-github-actions:${{ steps.fetch_version.outputs.last }}
docker push ghcr.io/psalm/psalm-github-actions:latest