Skip to content

Commit

Permalink
feat: add release job
Browse files Browse the repository at this point in the history
  • Loading branch information
s1n7ax committed Dec 5, 2023
0 parents commit 95231f7
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Release Artifacts on New Versions
on:
schedule:
- cron: "0 0 * * *"

permissions:
contents: write

jobs:
version_check:
name: Version Check
outputs:
UPSTREAM_VERSION: "${{ steps.latest-releases.outputs.upstream-version }}"
RELEASES_VERSION: "${{ steps.latest-releases.outputs.releases-version }}"
runs-on: ubuntu-latest
timeout-minutes: 600
steps:
- name: Check latest release in upstream
id: latest-releases
run: |
get_latest_release() {
URL="https://github.com/$1/$2/releases/latest"
VERSION=$(curl -is "$URL" \
| grep location \
| awk -F '/' '{print $8}')
echo "${VERSION/$'\r'/}"
}
UPS_VER="$(get_latest_release 'microsoft' 'vscode-java-test')"
REL_VER="$(get_latest_release 'nvim-java' 'vscode-java-test-releases')"
echo "upstream-version=$UPS_VER" >> "$GITHUB_OUTPUT"
echo "releases-version=$REL_VER" >> "$GITHUB_OUTPUT"
linux:
name: Linux
needs: version_check
if: needs.version_check.outputs.UPSTREAM_VERSION != needs.version_check.outputs.RELEASES_VERSION
env:
VERSION: "${{ needs.version_check.outputs.UPSTREAM_VERSION }}"
runs-on: ubuntu-latest
timeout-minutes: 600
steps:
- name: Check with current version
run: |
# currently the latest version is 0.40.1 but it fail to build so using the main repository
# wget "https://github.com/microsoft/vscode-java-test/archive/refs/tags/${VERSION}.tar.gz"
# tar xf "${VERSION}.tar.gz" -C . --strip-components=1
if [ "$VERSION" != "0.40.1" ]; then
echo "From the new version, release source files should be used"
exit 1
fi
git clone "https://github.com/microsoft/vscode-java-test.git" .
# NOT SURE IF THIS IS NEEDED
# - name: Setup Build Environment
# run: |
# sudo apt-get update
# sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
# sudo /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
# sleep 3

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 16

- name: Install Node.js modules
run: |
npm install
npm run build-plugin
npm run vscode:prepublish
mkdir extension
mv \
CHANGELOG.md \
dist \
LICENSE.txt \
main.js \
package.json \
package.nls.json \
package.nls.zh.json \
README.md \
resources \
SECURITY.md \
server \
ThirdPartyNotices.txt \
extension
zip -r "artifacts.zip" extension
- uses: ncipollo/release-action@v1
with:
artifacts: "artifacts.zip"
allowUpdates: true
artifactErrorsFailBuild: true
name: "${{ env.VERSION }}"
tag: "${{ env.VERSION }}"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 nvim-java

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# :coffee: vscode-java-test-releases

![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)
![Lua](https://img.shields.io/badge/lua-%232C2D72.svg?style=for-the-badge&logo=lua&logoColor=white)
![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge&logo=openjdk&logoColor=white)
![Gradle](https://img.shields.io/badge/Gradle-02303A.svg?style=for-the-badge&logo=Gradle&logoColor=white)
![Apache Maven](https://img.shields.io/badge/Apache%20Maven-C71A36?style=for-the-badge&logo=Apache%20Maven&logoColor=white)

This repository releases build artifacts of [vscode-java-test](https://github.com/microsoft/vscode-java-test)

## Head on to main project [:coffee: nvim-java](https://github.com/nvim-java/nvim-java)

0 comments on commit 95231f7

Please sign in to comment.