diff --git a/.github/actions/zip-system/action.yml b/.github/actions/zip-system/action.yml new file mode 100644 index 0000000..ab61cdd --- /dev/null +++ b/.github/actions/zip-system/action.yml @@ -0,0 +1,27 @@ +name: "Zip Project" +description: "Zips the project for distribution" + +inputs: + path: + description: "Path to output directory for zip file" + required: false + default: "" +runs: + using: "composite" + steps: + - name: Zip + shell: bash + run: | + if [[ -z "${{ inputs.path }}" ]]; then + OUTPUT_PATH="deltagreen.zip" + else + OUTPUT_PATH="${{ inputs.path }}/deltagreen.zip" + fi + zip -r "${OUTPUT_PATH}" . \ + -x "packs/source/*" \ + -x "build/*" \ + -x "dist/*" \ + -x ".*" \ + -x "package.json" \ + -x "package-lock.json" \ + -x "node_modules/*" diff --git a/.github/workflows/publish-dev-release.yml b/.github/workflows/publish-dev-release.yml index 5bddc6b..bbe4809 100644 --- a/.github/workflows/publish-dev-release.yml +++ b/.github/workflows/publish-dev-release.yml @@ -40,14 +40,9 @@ jobs: run: mkdir -p dist/dev && cp system.json dist/dev/dev-system.json - name: Zip - run: | - zip -r dist/dev/deltagreen.zip . \ - -x "packs/source/*" \ - -x "build/*" \ - -x ".*" \ - -x "package.json" \ - -x "package-lock.json" \ - -x "node_modules/*" + uses: ./.github/actions/zip-system + with: + path: "dist/dev" # Deploy to GitHub Pages (see https://github.com/actions/starter-workflows/blob/main/pages/static.yml) - name: Setup Pages diff --git a/.github/workflows/publish-prod-release.yml b/.github/workflows/publish-prod-release.yml index 1bb64bc..a9337b7 100644 --- a/.github/workflows/publish-prod-release.yml +++ b/.github/workflows/publish-prod-release.yml @@ -38,14 +38,7 @@ jobs: download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/deltagreen.zip - name: Zip - run: | - zip -r deltagreen.zip . \ - -x "packs/source/*" \ - -x "build/*" \ - -x ".*" \ - -x "package.json" \ - -x "package-lock.json" \ - -x "node_modules/*" + uses: ./.github/actions/zip-system - name: Update Release with Artifacts uses: ncipollo/release-action@v1.13.0