From 05d7bd16e79f56a4da1832b99cf4a99001572a5a Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 23 Sep 2024 20:12:26 -0400 Subject: [PATCH 1/4] Publish binaries and VS Code on GitHub release --- .github/workflows/build.yml | 30 +++++++++++++- .github/workflows/release.yml | 74 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index caf04b0..119b0c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - run: cargo test - vscode: + build: strategy: fail-fast: false matrix: @@ -42,8 +42,12 @@ jobs: - uses: actions/checkout@v4 - run: ${{ matrix.install-script }} - run: rustup target add ${{ matrix.rust-target }} - - run: npm ci - run: cargo build --release --target ${{ matrix.rust-target }} + - uses: actions/upload-artifact@v4 + with: + name: adroit-${{ matrix.target }} + path: target/${{ matrix.target }}/release/adroit${{ matrix.ext }} + - run: npm ci - run: mkdir packages/adroit-vscode/bin - run: cp target/${{ matrix.rust-target }}/release/adroit${{ matrix.ext }} packages/adroit-vscode/bin/adroit${{ matrix.ext }} - run: npm run --workspace=adroit-vscode build -- --target ${{ matrix.vscode-platform }} @@ -51,3 +55,25 @@ jobs: with: name: adroit-vscode-${{ matrix.vscode-platform }} path: packages/adroit-vscode/adroit-vscode-*.vsix + + vscode: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: adroit-win32-x64 + path: vsix + - uses: actions/download-artifact@v4 + with: + name: adroit-linux-x64 + path: vsix + - uses: actions/download-artifact@v4 + with: + name: adroit-darwin-x64 + path: vsix + - uses: actions/download-artifact@v4 + with: + name: adroit-darwin-arm64 + path: vsix + - run: ls vsix diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d7c1415 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,74 @@ +name: Release +on: + release: + types: + - created + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - vscode-platform: win32-x64 + rust-target: x86_64-pc-windows-gnu + github-os: ubuntu-22.04 + ext: ".exe" + install-script: sudo apt-get install -y mingw-w64 + - vscode-platform: linux-x64 + rust-target: x86_64-unknown-linux-musl + github-os: ubuntu-22.04 + ext: "" + install-script: "" + - vscode-platform: darwin-x64 + rust-target: x86_64-apple-darwin + github-os: macos-13 + ext: "" + install-script: "" + - vscode-platform: darwin-arm64 + rust-target: aarch64-apple-darwin + github-os: macos-14 + ext: "" + install-script: "" + runs-on: ${{ matrix.github-os }} + steps: + - uses: actions/checkout@v4 + - run: ${{ matrix.install-script }} + - run: rustup target add ${{ matrix.rust-target }} + - run: cargo build --release --target ${{ matrix.rust-target }} + - uses: softprops/action-gh-release@v2 + with: + files: target/${{ matrix.rust-target }}/release/adroit${{ matrix.ext }} + - run: npm ci + - run: mkdir packages/adroit-vscode/bin + - run: cp target/${{ matrix.rust-target }}/release/adroit${{ matrix.ext }} packages/adroit-vscode/bin/adroit${{ matrix.ext }} + - run: npm run --workspace=adroit-vscode build -- --target ${{ matrix.vscode-platform }} + - uses: actions/upload-artifact@v4 + with: + name: adroit-vscode-${{ matrix.vscode-platform }} + path: packages/adroit-vscode/adroit-vscode-*.vsix + + vscode: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: adroit-win32-x64 + path: vsix + - uses: actions/download-artifact@v4 + with: + name: adroit-linux-x64 + path: vsix + - uses: actions/download-artifact@v4 + with: + name: adroit-darwin-x64 + path: vsix + - uses: actions/download-artifact@v4 + with: + name: adroit-darwin-arm64 + path: vsix + - run: npm ci + - run: npx vsce publish --packagePath vsix/* + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} diff --git a/.gitignore b/.gitignore index d023ddb..4d5a8d7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /packages/adroit-vscode/bin/ /packages/adroit-vscode/dist/ /target/ +/vsix/ node_modules/ From ba47e0e03598486278222b29c64de8922ae1613f Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 23 Sep 2024 20:13:17 -0400 Subject: [PATCH 2/4] Add workflow dependency --- .github/workflows/build.yml | 1 + .github/workflows/release.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 119b0c8..a9f783a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,7 @@ jobs: path: packages/adroit-vscode/adroit-vscode-*.vsix vscode: + needs: build runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7c1415..9290ad5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,6 +49,7 @@ jobs: path: packages/adroit-vscode/adroit-vscode-*.vsix vscode: + needs: build runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 From 21a5ece80226598c20e3125bf4c27faf33ebe9fe Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 23 Sep 2024 20:16:35 -0400 Subject: [PATCH 3/4] Correct artifact names --- .github/workflows/build.yml | 8 ++++---- .github/workflows/release.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9f783a..6b92459 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,18 +63,18 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: adroit-win32-x64 + name: adroit-vscode-win32-x64 path: vsix - uses: actions/download-artifact@v4 with: - name: adroit-linux-x64 + name: adroit-vscode-linux-x64 path: vsix - uses: actions/download-artifact@v4 with: - name: adroit-darwin-x64 + name: adroit-vscode-darwin-x64 path: vsix - uses: actions/download-artifact@v4 with: - name: adroit-darwin-arm64 + name: adroit-vscode-darwin-arm64 path: vsix - run: ls vsix diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9290ad5..04d9016 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,19 +55,19 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: adroit-win32-x64 + name: adroit-vscode-win32-x64 path: vsix - uses: actions/download-artifact@v4 with: - name: adroit-linux-x64 + name: adroit-vscode-linux-x64 path: vsix - uses: actions/download-artifact@v4 with: - name: adroit-darwin-x64 + name: adroit-vscode-darwin-x64 path: vsix - uses: actions/download-artifact@v4 with: - name: adroit-darwin-arm64 + name: adroit-vscode-darwin-arm64 path: vsix - run: npm ci - run: npx vsce publish --packagePath vsix/* From b8ee45c5dc58e72b60abbe28c0932749c70356ed Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 23 Sep 2024 20:20:21 -0400 Subject: [PATCH 4/4] Finish --- .github/workflows/build.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b92459..205cf41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,26 +55,3 @@ jobs: with: name: adroit-vscode-${{ matrix.vscode-platform }} path: packages/adroit-vscode/adroit-vscode-*.vsix - - vscode: - needs: build - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - name: adroit-vscode-win32-x64 - path: vsix - - uses: actions/download-artifact@v4 - with: - name: adroit-vscode-linux-x64 - path: vsix - - uses: actions/download-artifact@v4 - with: - name: adroit-vscode-darwin-x64 - path: vsix - - uses: actions/download-artifact@v4 - with: - name: adroit-vscode-darwin-arm64 - path: vsix - - run: ls vsix