diff --git a/action.yml b/action.yml index 0656cf2..b33d9e3 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,25 @@ runs: with: node-version: ${{ steps.read-nvm.outputs.version }} + - name: Create temporary artifacts directory + shell: bash + run: | + # Note: creating the directory for artifacts one level up from the checkout directory so that we do not commit + # the artifacts to the repository is not allowed by actions/upload-artifact + mkdir __artifacts + # Ensure there will always at least one file in the archive so that there are no issues creating it + touch __artifacts/placeholder + + - name: Output versions + shell: bash + run: | + echo "node version is:" + node --version + echo "npm version is:" + npm --version + echo "yarn version is:" + yarn --version + - name: Install admin JS if: github.event.repository.name != 'silverstripe-admin' shell: bash @@ -142,10 +161,36 @@ runs: fi done + - name: Copy artifacts + if: always() + shell: bash + run: | + AT_LEAST_ONE_FILE=0 + if [[ -f package.json ]]; then + cp package.json __artifacts + AT_LEAST_ONE_FILE=1 + fi + if [[ -f yarn.lock ]]; then + cp yarn.lock __artifacts + AT_LEAST_ONE_FILE=1 + fi + if [[ $AT_LEAST_ONE_FILE == 1 ]]; then + rm __artifacts/placeholder + fi + + # https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts + - name: Upload artifacts + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # @v3.1.2 + if: always() + with: + name: artifacts + path: __artifacts + - name: Delete temporary files shell: bash if: always() run: | + rm -rf __artifacts if [[ -f __branches.json ]]; then rm __branches.json fi