|
6 | 6 | version: |
7 | 7 | type: string |
8 | 8 | required: true |
| 9 | + schedule: |
| 10 | + - cron: "23 * * * *" |
9 | 11 |
|
10 | 12 | jobs: |
11 | 13 | update: |
12 | 14 | runs-on: ubuntu-latest |
13 | 15 | env: |
14 | | - VERSION: ${{ inputs.version }} |
| 16 | + TAG: ${{ inputs.version }} |
15 | 17 | GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} |
16 | 18 |
|
17 | 19 | steps: |
| 20 | + - name: Fetch latest tag |
| 21 | + if: env.TAG == '' |
| 22 | + run: | |
| 23 | + tag=$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/microsoft/vscode/releases/latest) |
| 24 | + tag="${tag#https://github.com/microsoft/vscode/releases/tag/}" |
| 25 | + echo "TAG=$tag" >> $GITHUB_ENV |
| 26 | +
|
| 27 | + - name: Remove leading v from tag |
| 28 | + run: | |
| 29 | + echo "VERSION=${TAG#v}" >> $GITHUB_ENV |
| 30 | +
|
18 | 31 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
19 | | - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
20 | 32 | with: |
21 | | - node-version-file: .node-version |
| 33 | + submodules: true |
| 34 | + |
| 35 | + - name: Check current version |
| 36 | + id: check |
| 37 | + run: | |
| 38 | + commit="$(git -C lib/vscode rev-parse HEAD)" |
| 39 | + if [[ $(git ls-remote --tags https://github.com/microsoft/vscode.git | grep "$commit") == */"$VERSION" ]] ; then |
| 40 | + echo done=true >> $GITHUB_OUTPUT |
| 41 | + elif git ls-remote --exit-code --heads https://github.com/coder/code-server.git "update/$VERSION" ; then |
| 42 | + echo done=true >> $GITHUB_OUTPUT |
| 43 | + else |
| 44 | + echo done=false >> $GITHUB_OUTPUT |
| 45 | + fi |
| 46 | +
|
| 47 | + - uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest |
| 48 | + if: steps.check.outputs.done == 'false' |
| 49 | + with: |
| 50 | + packages: quilt |
| 51 | + version: 1.0 |
22 | 52 |
|
23 | 53 | - run: ./ci/build/update-vscode.sh |
| 54 | + if: steps.check.outputs.done == 'false' |
24 | 55 |
|
25 | 56 | - name: Open PR |
| 57 | + if: steps.check.outputs.done == 'false' |
26 | 58 | run: | |
27 | 59 | git config --global user.name cdrci |
28 | 60 | git config --global user.email opensource@coder.com |
29 | | - git checkout -b update/${{ env.VERSION }} |
| 61 | + git checkout -b "update/$VERSION" |
30 | 62 | git add . |
31 | | - git commit -m "Update VS Code to ${{ env.VERSION }}" |
32 | | - git push -u origin $(git branch --show) |
33 | | - gh pr create --repo coder/code-server-aur \ |
34 | | - --title "Update VS Code to ${{ env.VERSION }}" \ |
| 63 | + git commit -m "Update VS Code to $VERSION" |
| 64 | + git push -u origin "$(git branch --show)" |
| 65 | + gh pr create \ |
| 66 | + --repo coder/code-server \ |
| 67 | + --title "Update VS Code to $VERSION" \ |
35 | 68 | --body-file .cache/checklist \ |
36 | 69 | --draft |
0 commit comments