]> git.lizzy.rs Git - rust.git/blobdiff - .github/workflows/release.yaml
Auto merge of #11980 - atouchet:repo, r=Veykril
[rust.git] / .github / workflows / release.yaml
index bb008b8ffa0125c3a1c8cd9ff7f3aa5f4dc58e6a..b1da92161070f416898ceae925151610c99307d7 100644 (file)
@@ -17,6 +17,7 @@ env:
   RUSTUP_MAX_RETRIES: 10
   FETCH_DEPTH: 0 # pull in the tags for the version string
   MACOSX_DEPLOYMENT_TARGET: 10.15
+  CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
 
 jobs:
   dist:
@@ -25,24 +26,28 @@ jobs:
         include:
           - os: windows-latest
             target: x86_64-pc-windows-msvc
+            code-target: win32-x64
           - os: windows-latest
             target: aarch64-pc-windows-msvc
-          - os: ubuntu-20.04
+            code-target: win32-arm64
+          - os: ubuntu-18.04
             target: x86_64-unknown-linux-gnu
-          - os: ubuntu-20.04
+            code-target: linux-x64
+          - os: ubuntu-18.04
             target: aarch64-unknown-linux-gnu
-            cross_linker: aarch64-linux-gnu-gcc
+            code-target: linux-arm64
           - os: macos-11
             target: x86_64-apple-darwin
+            code-target: darwin-x64
           - os: macos-11
             target: aarch64-apple-darwin
+            code-target: darwin-arm64
 
     name: dist (${{ matrix.target }})
     runs-on: ${{ matrix.os }}
 
     env:
       RA_TARGET: ${{ matrix.target }}
-      CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.cross_linker }}
 
     steps:
       - name: Checkout repository
@@ -77,7 +82,6 @@ jobs:
           components: rust-src
 
       - name: Install Node.js
-        if: matrix.target == 'x86_64-unknown-linux-gnu'
         uses: actions/setup-node@v1
         with:
           node-version: 14.x
@@ -90,13 +94,32 @@ jobs:
         if: matrix.target == 'aarch64-unknown-linux-gnu'
         run: sudo apt-get install gcc-aarch64-linux-gnu
 
-      - name: Dist (generic)
-        if: matrix.target != 'x86_64-unknown-linux-gnu'
-        run: cargo xtask dist
+      - name: Dist
+        run: cargo xtask dist --client-patch-version ${{ github.run_number }}
 
-      - name: Dist (Linux)
-        if: matrix.target == 'x86_64-unknown-linux-gnu'
-        run: cargo xtask dist --client-patch-version $GITHUB_RUN_NUMBER
+      - run: npm ci
+        working-directory: editors/code
+
+      - name: Package Extension (release)
+        if: github.ref == 'refs/heads/release'
+        run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
+        working-directory: editors/code
+
+      - name: Package Extension (nightly)
+        if: github.ref != 'refs/heads/release'
+        run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
+        working-directory: editors/code
+
+      - if: matrix.target == 'x86_64-unknown-linux-gnu'
+        run: rm -rf editors/code/server
+
+      - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref == 'refs/heads/release'
+        run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix
+        working-directory: editors/code
+
+      - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/heads/release'
+        run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix --pre-release
+        working-directory: editors/code
 
       - name: Run analysis-stats on rust-analyzer
         if: matrix.target == 'x86_64-unknown-linux-gnu'
@@ -126,7 +149,7 @@ jobs:
 
     steps:
       - name: Install dependencies
-        run: apk add --no-cache git clang lld musl-dev
+        run: apk add --no-cache git clang lld musl-dev nodejs npm
 
       - name: Checkout repository
         uses: actions/checkout@v2
@@ -134,7 +157,22 @@ jobs:
           fetch-depth: ${{ env.FETCH_DEPTH }}
 
       - name: Dist
-        run: cargo xtask dist
+        run: cargo xtask dist --client-patch-version ${{ github.run_number }}
+
+      - run: npm ci
+        working-directory: editors/code
+
+      - name: Package Extension (release)
+        if: github.ref == 'refs/heads/release'
+        run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64
+        working-directory: editors/code
+
+      - name: Package Extension (nightly)
+        if: github.ref != 'refs/heads/release'
+        run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 --pre-release
+        working-directory: editors/code
+
+      - run: rm -rf editors/code/server
 
       - name: Upload artifacts
         uses: actions/upload-artifact@v1
@@ -203,11 +241,18 @@ jobs:
           name: ${{ env.TAG }}
           token: ${{ secrets.GITHUB_TOKEN }}
 
+      - run: rm dist/rust-analyzer-no-server.vsix
+
       - run: npm ci
         working-directory: ./editors/code
 
-      - name: Publish Extension
-        if: github.ref == 'refs/heads/release'
+      - name: Publish Extension (release)
+        if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
         working-directory: ./editors/code
         # token from https://dev.azure.com/rust-analyzer/
-        run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix
+        run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
+
+      - name: Publish Extension (nightly)
+        if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
+        working-directory: ./editors/code
+        run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release