From 9d482eaa8890ddfc36c301a0207ae134739e4792 Mon Sep 17 00:00:00 2001 From: Tim Harding Date: Thu, 21 Mar 2024 22:11:20 -0700 Subject: [PATCH] Create release before building --- .github/workflows/ci.yml | 108 ++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc32793..fbed463 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,9 +9,29 @@ permissions: contents: write jobs: + create-release: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" \ + --verify-tag \ + --title="${TAG}" \ + --notes-from-tag + build-linux: runs-on: ubuntu-latest timeout-minutes: 10 + needs: + - create-release steps: - name: Checkout repository @@ -25,16 +45,21 @@ jobs: - name: Build run: cargo build --profile ci - - name: Archive artifact - uses: actions/upload-artifact@v4 - with: - name: neophyte-linux - path: target/ci/neophyte - retention-days: 1 + - name: Rename artifact + run: mv target/release/neophyte neophyte-linux + + - name: Upload to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release upload "$TAG" neophyte-linux build-macos: runs-on: macos-latest timeout-minutes: 10 + needs: + - create-release steps: - name: Checkout repository @@ -48,16 +73,22 @@ jobs: - name: Build run: cargo build --profile ci - - name: Archive artifact - uses: actions/upload-artifact@v4 - with: - name: neophyte-macos - path: target/ci/neophyte - retention-days: 1 + - name: Rename artifact + run: mv target/release/neophyte neophyte-macos + + - name: Upload to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release upload "$TAG" neophyte-macos + build-windows: runs-on: windows-latest timeout-minutes: 10 + needs: + - create-release steps: - name: Checkout repository @@ -71,49 +102,12 @@ jobs: - name: Build run: cargo build --profile ci - - name: Archive artifact - uses: actions/upload-artifact@v4 - with: - name: neophyte-windows.exe - path: target/ci/neophyte.exe - retention-days: 1 - - create-release: - runs-on: ubuntu-latest - timeout-minutes: 10 - needs: - - build-linux - - build-macos - - build-windows - - steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Rename artifact + run: mv target/release/neophyte.exe neophyte-windows.exe - - name: Download Linux artifact - uses: actions/download-artifact@v4 - with: - name: neophyte-linux - path: neophyte-linux - - - name: Download MacOS artifact - uses: actions/download-artifact@v4 - with: - name: neophyte-macos - path: neophyte-macos - - - name: Download Windows artifact - uses: actions/download-artifact@v4 - with: - name: neophyte-windows.exe - path: neophyte-windows.exe - - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAG: ${{ github.ref_name }} - run: | - gh release create "$TAG" neophyte-linux neophyte-macos neophyte-windows.exe \ - --verify-tag \ - --title="${TAG}" \ - --notes-from-tag + - name: Upload to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release upload "$TAG" neophyte-windows.exe