Create zip file of build on every push #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create zip file of build on every push | |
# Controls when the action will run. | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
# Run once every 2 months to ensure there's always a zip file available (build artifacts are deleted in 90 days) | |
- cron: '42 0 1 */2 *' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "create-zip" | |
create-zip: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Runs a single command using the runners shell | |
- name: Send greeting | |
run: echo "Hello world!" | |
- uses: actions/checkout@v2 | |
- name: Cache node_modules | |
uses: actions/[email protected] | |
with: | |
# A list of files, directories, and wildcard patterns to cache and restore | |
path: node_modules | |
# An explicit key for restoring and saving the cache | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0 | |
node-version: ">=10.15.0" # TODO: fix | |
- name: Install Dependencies | |
if: steps.node-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- run: npm run build | |
- name: Remove all old artifacts | |
# You may pin to the exact commit or the version. | |
# uses: c-hive/gha-remove-artifacts@24dc23384a1fa6a058b79c73727ae0cb2200ca4c | |
uses: c-hive/[email protected] | |
with: | |
# Artifacts older than this will be deleted (e.g. "2 months", "1 day"). Parsed by moment. | |
age: "1 minute" | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
# Artifact name | |
name: build | |
# A file, directory or wildcard pattern that describes what to upload | |
path: dist | |
retention-days: 90 |