From 95231f7a2885e282e127d15e7d6ea34d3fdf2760 Mon Sep 17 00:00:00 2001 From: s1n7ax Date: Wed, 6 Dec 2023 03:36:41 +0530 Subject: [PATCH] feat: add release job --- .github/workflows/release.yaml | 107 +++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++ README.md | 11 ++++ 3 files changed, 139 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 LICENSE create mode 100644 README.md diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3d490f4 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 }}" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e218c7e --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..58953ad --- /dev/null +++ b/README.md @@ -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)