diff --git a/.github/actions/extract-artifact/action.yml b/.github/actions/extract-artifact/action.yml new file mode 100644 index 000000000..8d9834cdf --- /dev/null +++ b/.github/actions/extract-artifact/action.yml @@ -0,0 +1,37 @@ +name: Extract Artifact +description: Waits for build, downloads and extracts the artifact +inputs: + check-name: + description: "Check name to wait for" + required: true + artifact-name: + description: "Name of the artifact to download" + required: true +runs: + using: "composite" + steps: + - name: Wait for build + uses: lewagon/wait-on-check-action@v1.3.4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + check-name: ${{ inputs.check-name }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 30 + + - name: Download workflow artifact + uses: dawidd6/action-download-artifact@v6 + with: + workflow: build.yml + name: ${{ inputs.artifact-name }} + + - name: Extract artifact (Linux) + if: runner.os == 'Linux' + run: | + chmod +x lmms-*.AppImage + ./lmms-*.AppImage --appimage-extract + + - name: Mount DMG (macOS) + if: runner.os == 'macOS' + run: | + hdiutil attach lmms-*.dmg -mountpoint ~/tmpvolume + cp -R ~/tmpvolume/LMMS.app /tmp/ diff --git a/.github/workflows/run-help.yml b/.github/workflows/run-help.yml index b4a7a7b88..0a46f780e 100644 --- a/.github/workflows/run-help.yml +++ b/.github/workflows/run-help.yml @@ -19,22 +19,11 @@ jobs: name: help-linux-${{ matrix.config.arch }} runs-on: ${{ matrix.config.runner }} steps: - - name: wait for build - uses: lewagon/wait-on-check-action@v1.3.4 - with: - ref: ${{ github.event.pull_request.head.sha || github.sha }} - check-name: linux-${{ matrix.config.arch }} - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 30 - - name: Download workflow artifact - uses: dawidd6/action-download-artifact@v6 - with: - workflow: build.yml - name: linux${{ matrix.config.suffix }} - name: Extract artifact - run: | - chmod +x lmms-*.AppImage - ./lmms-*.AppImage --appimage-extract + uses: ./.github/actions/extract-artifact + with: + check-name: linux-${{ matrix.config.arch }} + artifact-name: linux${{ matrix.config.suffix }} - name: Display help run: | cd squashfs-root/ @@ -51,22 +40,11 @@ jobs: name: help-macos-${{ matrix.config.arch }} runs-on: ${{ matrix.config.runner }} steps: - - name: wait for build - uses: lewagon/wait-on-check-action@v1.3.4 + - name: Extract artifact + uses: ./.github/actions/extract-artifact with: - ref: ${{ github.event.pull_request.head.sha || github.sha }} check-name: macos-${{ matrix.config.arch }} - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 30 - - name: Download workflow artifact - uses: dawidd6/action-download-artifact@v6 - with: - workflow: build.yml - name: macos-${{ matrix.config.arch }} - - name: Mount the DMG - run: | - hdiutil attach lmms-*.dmg -mountpoint ~/tmpvolume - cp -R ~/tmpvolume/LMMS.app /tmp/ + artifact-name: macos-${{ matrix.config.arch }} - name: Display help run: | /tmp/LMMS.app/Contents/MacOS/lmms --help | grep "Usage: lmms"