From 836bbba7feca3eb29a4792f27a7b3dfd31f53f7a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 18 Jan 2025 20:55:46 +0200 Subject: [PATCH] refactor(ci): deduplicate preparing artifacts --- .github/workflows/main.yml | 17 +---------------- .github/workflows/nightly.yml | 17 +---------------- .github/workflows/release.yml | 19 ++----------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 362f3d1b4..8610346aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,22 +42,7 @@ jobs: with: os: ${{ matrix.os.name }} arch: ${{ matrix.arch }} - - name: Prepare artifacts (Unix) - if: runner.os != 'windows' - run: | - mkdir -p upload - file=$(find out/make -name '*.zip' -print -quit) - cp "$file" "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}-${{ github.ref_name }}.zip" - file=$(find out/make -name '*.${{ matrix.os.extension }}' -print -quit) - cp "$file" "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}-${{ github.ref_name }}.${{ matrix.os.extension }}" - - name: Prepare artifacts (Windows) - if: runner.os == 'windows' - run: | - mkdir upload - $file = Get-ChildItem -Path out/make -Filter '*.zip' -Recurse | Select-Object -First 1 - Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}-${{ github.ref_name }}.zip" - $file = Get-ChildItem -Path out/make -Filter '*.${{ matrix.os.extension }}' -Recurse | Select-Object -First 1 - Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}-${{ github.ref_name }}.${{ matrix.os.extension }}" + extension: ${{ matrix.os.extension }} - name: Publish artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2e14884f3..81c21aefa 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,22 +41,7 @@ jobs: with: os: ${{ matrix.os.name }} arch: ${{ matrix.arch }} - - name: Prepare artifacts (Unix) - if: runner.os != 'windows' - run: | - mkdir -p upload - file=$(find out/make -name '*.zip' -print -quit) - cp "$file" "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.zip" - file=$(find out/make -name '*.${{ matrix.os.extension }}' -print -quit) - cp "$file" "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }}" - - name: Prepare artifacts (Windows) - if: runner.os == 'windows' - run: | - mkdir upload - $file = Get-ChildItem -Path out/make -Filter '*.zip' -Recurse | Select-Object -First 1 - Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.zip" - $file = Get-ChildItem -Path out/make -Filter '*.${{ matrix.os.extension }}' -Recurse | Select-Object -First 1 - Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }}" + extension: ${{ matrix.os.extension }} - name: Publish artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f2e82e14..aba519fcd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,23 +38,8 @@ jobs: uses: ./.github/actions/build with: os: ${{ matrix.os.name }} - arch: ${{ matrix.arch }} - - name: Prepare artifacts (Unix) - if: runner.os != 'windows' - run: | - mkdir -p upload - file=$(find out/make -name '*.zip' -print -quit) - cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ matrix.os.name }}-${{ matrix.arch }}.zip" - file=$(find out/make -name '*.${{ matrix.os.extension }}' -print -quit) - cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }}" - - name: Prepare artifacts (Windows) - if: runner.os == 'windows' - run: | - mkdir upload - $file = Get-ChildItem -Path out/make -Filter '*.zip' -Recurse | Select-Object -First 1 - Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ github.ref_name }}-${{ matrix.os.name }}-${{ matrix.arch }}.zip" - $file = Get-ChildItem -Path out/make -Filter '*.${{ matrix.os.extension }}' -Recurse | Select-Object -First 1 - Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ github.ref_name }}-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }}" + arch: ${{ matrix.arch }} + extension: ${{ matrix.os.extension }} - name: Publish release uses: softprops/action-gh-release@v2 with: