forked from project-chip/matter-handbook
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.8 KB
/
Copy pathretype-version-update.yml
File metadata and controls
60 lines (50 loc) · 1.8 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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