Skip to content

Commit

Permalink
feat(workflow): update artifacts workflow target
Browse files Browse the repository at this point in the history
  • Loading branch information
asmodeus812 committed Jan 23, 2025
1 parent 4897a4f commit 8a91ca5
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: update_server
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
jobs:
update-server:
name: Update binaries
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Update artifacts
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
make update
- name: Commit changes
env:
COMMIT_MSG: |
bump(version): Update server artifacts
run: |
git config user.email "actions@github"
git config user.name "Github Actions"
git add .
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: generate
update:
./scripts/update.sh
21 changes: 21 additions & 0 deletions scripts/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo "Verify gh version"
gh --version

release_tag=$(gh api "repos/eclipse-jdtls/eclipse.jdt.ls/tags" --jq '.[0].name')
release_tag=$(echo "$release_tag" | sed 's/^v//')

target_url="https://download.eclipse.org/jdtls/milestones/$release_tag"
curl -L -o release.txt "$target_url/latest.txt"
echo "Targeting $release_tag from eclipse-jdtls/eclipse.jdt.ls"

artifact_name=$(cat release.txt)
echo "Downloading $artifact_name from $target_url"
curl -L -o server.tar.gz "$target_url/$artifact_name"
rm -rf release.txt

echo "Extracting server resource artifacts"
rm -rf ./server && mkdir -p server
tar -xvzf server.tar.gz -C ./server
rm -rf server.tar.gz

0 comments on commit 8a91ca5

Please sign in to comment.