From 2ffe7aae1abf6ba150b90898d55574265d5599d8 Mon Sep 17 00:00:00 2001 From: Bo Lopker Date: Tue, 14 Jan 2025 14:36:03 -0800 Subject: [PATCH] More workflow --- .github/workflows/{binaries.yml => ci.yml} | 45 +++++++++++++++++++++- .github/workflows/release.yml | 38 ------------------ .github/workflows/test.yml | 21 ---------- 3 files changed, 43 insertions(+), 61 deletions(-) rename .github/workflows/{binaries.yml => ci.yml} (72%) delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/binaries.yml b/.github/workflows/ci.yml similarity index 72% rename from .github/workflows/binaries.yml rename to .github/workflows/ci.yml index 2923440..73bf3b5 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,26 @@ -name: Binaries +name: Test on: push: branches: ["main"] + tags: + - v* pull_request: branches: ["main"] +env: + CARGO_TERM_COLOR: always + jobs: - release: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build + - name: Run tests + run: cargo test + build: name: Release ${{ matrix.platform.project }} - ${{ matrix.platform.release_for }} if: github.event.pull_request.draft == false strategy: @@ -75,3 +88,31 @@ jobs: with: name: ${{ matrix.platform.bin }}-${{ matrix.platform.target }} path: ${{ matrix.platform.name }} + release: + name: Release + needs: + - build + - test + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: artifacts + pattern: codebook-lsp-* + - name: Make release + uses: softprops/action-gh-release@v2 + with: + files: | + artifacts/codebook-lsp* + prerelease: true + fail_on_unmatched_files: true + generate_release_notes: true + draft: false + tag_name: ${{ github.ref_name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6f10f06..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release -on: - workflow_run: - workflows: ["Test", "Binaries"] - branches: [main] - tags: - - v* - types: - - completed - -jobs: - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts - path: artifacts - pattern: codebook-lsp-* - run-id: ${{ github.event.workflow_run.id }} - - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - files: | - artifacts/codebook-lsp* - prerelease: true - fail_on_unmatched_files: true - generate_release_notes: true - draft: false - tag_name: ${{ github.ref_name }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index b6fd6b2..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Test - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build - run: cargo build - - name: Run tests - run: cargo test