From 3983e542b21935a87b46383ef5c1a836521ad9a3 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Mon, 11 Apr 2022 02:18:20 -0500 Subject: [PATCH] CI: Enable macOS artifacts --- .github/workflows/macos-workflow.yml | 75 ++++++++++++------- .../upload-release-artifacts/index.js | 3 +- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/.github/workflows/macos-workflow.yml b/.github/workflows/macos-workflow.yml index a227c8b96a..c827ce7619 100644 --- a/.github/workflows/macos-workflow.yml +++ b/.github/workflows/macos-workflow.yml @@ -6,31 +6,8 @@ on: push: branches: - master - paths-ignore: - - '**/*.md' - - '**/*.bat' - - '**/*.cmd' - - '**/*.props' - - '**/*.sln' - - '.clang-format' - - '.codacy.yaml' - - '.github/*' - - '.github/workflows/lint-gamedb.yml' - - '.github/workflows/linux-workflow.yml' - - '.github/workflows/pr-triage.yml' - - '.github/workflows/scripts/windows/**' - - '.github/workflows/scripts/validation/**' - - '.github/workflows/windows-workflow.yml' - - '.gitignore' - - 'bin/PCSX2_keys.ini.default' - - 'build.sh' - - 'buildbot.xml' - - 'pcsx2/CDVD/Windows/**' - - 'pcsx2/DEV9/Win32/**' - - 'pcsx2/PAD/Windows/**' - - 'pcsx2/SPU2/Windows/**' - - 'pcsx2/USB/Win32/**' - - 'pcsx2/windows/**' + tags: + - v* pull_request: branches: - master @@ -119,3 +96,51 @@ jobs: - name: Run Tests working-directory: build run: make -j$(getconf _NPROCESSORS_ONLN) unittests + + - name: Prepare Artifact Metadata + id: artifact-metadata + run: | + if [ ${{ github.event_name }} == "pull_request" ]; then + PR_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + ARTIFACT_NAME="PCSX2" + if [ -n "${{ github.event.pull_request.number }}" ]; then + PR_NUM=${{ github.event.pull_request.number }} + ARTIFACT_NAME="${ARTIFACT_NAME}-pr[${PR_NUM}]" + fi + ARTIFACT_NAME="${ARTIFACT_NAME}-sha[${PR_SHA}]" + if [ -n "${{ github.event.pull_request.title }}" ]; then + PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr -cd '[a-zA-Z0-9[:space:]]_-') + ARTIFACT_NAME="${ARTIFACT_NAME}-title[${PR_TITLE}" + fi + else + SHA=$(git rev-parse --short "$GITHUB_SHA") + ARTIFACT_NAME="PCSX2-sha[${SHA}" + fi + TRIMMED_ARTIFACT_NAME=$(printf "%.199s]" "$ARTIFACT_NAME") + echo "name=$TRIMMED_ARTIFACT_NAME" + echo "##[set-output name=name;]${TRIMMED_ARTIFACT_NAME}" + + - name: Prepare Build Artifacts + run: | + mv build/pcsx2/PCSX2.app "${{ steps.artifact-metadata.outputs.name }}.app" + tar cvzf "${{ steps.artifact-metadata.outputs.name }}.tar.gz" "${{ steps.artifact-metadata.outputs.name }}.app" + mkdir ci-artifacts + cp "${{ steps.artifact-metadata.outputs.name }}.tar.gz" ci-artifacts/macOS.tar.gz + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.artifact-metadata.outputs.name }} + path: "*.tar.gz" + + - name: Upload Assets and Potential Publish Release + if: github.repository == 'PCSX2/pcsx2' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.BOT_PAT }} + ASSET_DIR: ${{ github.WORKSPACE }}/ci-artifacts + ASSET_EXTENSION: tar.gz + TAG_TO_SEARCH_FOR: ${{ github.REF }} + run: | + cd .github/workflows/scripts/releases/upload-release-artifacts + npm ci + node index.js diff --git a/.github/workflows/scripts/releases/upload-release-artifacts/index.js b/.github/workflows/scripts/releases/upload-release-artifacts/index.js index 9af0100eca..9d301d46e7 100644 --- a/.github/workflows/scripts/releases/upload-release-artifacts/index.js +++ b/.github/workflows/scripts/releases/upload-release-artifacts/index.js @@ -113,7 +113,8 @@ const { data: releaseAssetsPost } = await octokit.rest.repos.listReleaseAssets({ let expectedAssets = { "windows-64bit-sse4": false, "windows-64bit-avx2": false, - "linux-appimage-64bit": false + "linux-appimage-64bit": false, + "macos": false, } for (var i = 0; i < releaseAssetsPost.length; i++) {