diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 03bde8b..32e5dbf 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -17,6 +17,8 @@ permissions: jobs: build: runs-on: ${{ matrix.os }} + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] @@ -38,10 +40,15 @@ jobs: override: true - name: Build run: cargo build --release --target ${{ matrix.target }} + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: doclytics-${{ env.BRANCH_NAME }}-${{ matrix.os }} + path: | + ./target/${{ matrix.target }}/release/doclytics${{ matrix.os == 'windows-latest' && '.exe' || '' }} build-docker: needs: build runs-on: ubuntu-latest - if: ${{ github.ref }} != 'master' && ${{ github.ref }} != 'development' env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} steps: @@ -68,7 +75,7 @@ jobs: contents: write issues: write pull-requests: write - if: false #${{ github.ref }} == 'master' || ${{ github.ref }} == 'development' + if: ${{ github.ref }} == 'master' || ${{ github.ref }} == 'development' steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 3a861ae..d32e0c6 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -9,6 +9,46 @@ env: CI: true jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: macos-latest + target: x86_64-apple-darwin + - os: windows-latest + target: x86_64-pc-windows-msvc + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + profile: minimal + override: true + - name: Build + run: cargo build --release --target ${{ matrix.target }} + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: doclytics-${{ env.BRANCH_NAME }}-${{ matrix.os }} + path: | + ./target/${{ matrix.target }}/release/doclytics${{ matrix.os == 'windows-latest' && '.exe' || '' }} + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + if: ${{ github.ref }} != 'master' && ${{ github.ref }} != 'development' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./target/${{ matrix.target }}/release/doclytics${{ matrix.os == 'windows-latest' && '.exe' || '' }} + asset_name: doclytics-${{ env.BRANCH_NAME }}-${{ matrix.os }} + asset_content_type: application/octet-stream} build-docker: needs: build runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b30263..b55556f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,9 +9,47 @@ env: CI: true jobs: - + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: macos-latest + target: x86_64-apple-darwin + - os: windows-latest + target: x86_64-pc-windows-msvc + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + profile: minimal + override: true + - name: Build + run: cargo build --release --target ${{ matrix.target }} + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: doclytics-${{ env.BRANCH_NAME }}-${{ matrix.os }} + path: | + ./target/${{ matrix.target }}/release/doclytics${{ matrix.os == 'windows-latest' && '.exe' || '' }} + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + if: ${{ github.ref }} != 'master' && ${{ github.ref }} != 'development' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./target/${{ matrix.target }}/release/doclytics${{ matrix.os == 'windows-latest' && '.exe' || '' }} + asset_name: doclytics-${{ env.BRANCH_NAME }}-${{ matrix.os }} + asset_content_type: application/octet-stream build-docker: - needs: build runs-on: ubuntu-latest if: ${{ github.ref }} != 'master' && ${{ github.ref }} != 'development' env: @@ -37,4 +75,36 @@ jobs: context: . push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/doclytics:${{ env.BRANCH_NAME }} - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/amd64,linux/arm64 + - name: Upload macOS Binary + uses: actions/upload-release-asset@v1 + if: steps.semantic-release.outputs.release_created == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.semantic-release.outputs.release_upload_url }} + asset_path: ./target/x86_64-apple-darwin/release/your-binary + asset_name: your-binary-macos + asset_content_type: application/octet-stream + + - name: Upload Windows Binary + uses: actions/upload-release-asset@v1 + if: steps.semantic-release.outputs.release_created == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.semantic-release.outputs.release_upload_url }} + asset_path: ./target/x86_64-pc-windows-msvc/release/your-binary.exe + asset_name: your-binary-windows.exe + asset_content_type: application/octet-stream + + - name: Upload Linux Binary + uses: actions/upload-release-asset@v1 + if: steps.semantic-release.outputs.release_created == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.semantic-release.outputs.release_upload_url }} + asset_path: ./target/x86_64-unknown-linux-gnu/release/your-binary + asset_name: your-binary-linux + asset_content_type: application/octet-stream