From ad5ebbcad72e0c7a2a598a63147cf39b30bc17c2 Mon Sep 17 00:00:00 2001 From: "James (Jamalam)" Date: Tue, 26 Mar 2024 16:46:09 +0000 Subject: [PATCH] feat(ci): first draft of release uploading --- .github/workflows/release.yml | 58 +++++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e89aa73..8be9f0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,8 @@ jobs: permissions: # Allows creation of releases contents: write + outputs: + release_upload_url: ${{ steps.create_release.outputs.upload_url }} steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -29,11 +31,13 @@ jobs: - name: Package VSCode Extension working-directory: vscode run: npm run package + - name: Publish to VSCode Marketplace working-directory: vscode run: npm run publish:vsce env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + - name: Publish to OpenVSX working-directory: vscode run: npm run publish:ovsx @@ -55,6 +59,7 @@ jobs: echo "COMMITS<<$EOF" >> $GITHUB_OUTPUT echo "COMMITS=\"$(awk -v latest="$(grep -Eo '^## v[0-9]+\.[0-9]+\.[0-9]+$' CHANGELOG.md | head -n1)" '/^## v/ {if (header) exit; header=1} /^## v'${latest}'/{print; next} header && !/^## v/{print}' CHANGELOG.md)\"" >> $GITHUB_OUTPUT echo "$EOF" >> $GITHUB_OUTPUT + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -74,6 +79,7 @@ jobs: ${{ steps.get_changelog.outputs.COMMITS }} draft: true prerelease: false + - uses: xresloader/upload-to-github-release@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -81,3 +87,55 @@ jobs: file: "vscode/pest.vsix;sublime-text/pest.sublime-package" release_id: ${{ steps.create_release.outputs.id }} overwrite: true + + build-binaries: + needs: release + runs-on: ubuntu-latest + + permissions: + # So we can upload to the release + contents: write + + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + arch: [x86_64] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup + uses: ./.github/actions/setup + with: + kind: release-compile-binaries + secret: ${{ secrets.GITHUB_TOKEN }} + + - name: Build binary + run: cargo build --release --target=$TARGET + + - name: Package binary + run: tar -czvf pest-lsp-${{ matrix.os }}-${{ matrix.arch }}.tar.gz -C target/$TARGET/release/* + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.release.tag_name }} + release_name: ${{ github.event.release.tag_name }} + body: | + Release ${{ github.event.release.tag_name }} + draft: false + prerelease: false + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ jobs.release.outputs.release_upload_url }} + asset_path: ./pest-language-server-${{ matrix.os }}-${{ matrix.arch }}.tar.gz + asset_name: pest-language-server-${{ matrix.os }}-${{ matrix.arch }}.tar.gz + asset_content_type: application/gzip diff --git a/Cargo.lock b/Cargo.lock index 38a6299..f25db42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -903,7 +903,7 @@ dependencies = [ [[package]] name = "pest-language-server" -version = "0.3.6" +version = "0.3.7" dependencies = [ "pest", "pest_fmt",