111 lines
2.5 KiB
YAML
111 lines
2.5 KiB
YAML
name: Continues Integration
|
|
on: [push, workflow_dispatch]
|
|
|
|
jobs:
|
|
dependencies:
|
|
name: Install dependencies
|
|
container: git.zakscode.com/ztimson/runner
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Restore node_modules
|
|
uses: actions/cache/restore@v3
|
|
with:
|
|
path: ./node_modules
|
|
key: node_modules
|
|
restore-keys: node_modules
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ./node_modules
|
|
key: node_modules
|
|
restore-keys: node_modules
|
|
|
|
build-dev:
|
|
name: Build
|
|
needs: dependencies
|
|
container: git.zakscode.com/ztimson/runner
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Restore node_modules
|
|
uses: actions/cache/restore@v3
|
|
with:
|
|
path: ./node_modules
|
|
key: node_modules
|
|
restore-keys: node_modules
|
|
|
|
- name: Build sources
|
|
run: npm run build:dev
|
|
|
|
- name: Compress artifacts
|
|
run: tar -czvf dist.tar.gz dist
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-dev
|
|
path: dist.tar.gz
|
|
|
|
build-prod:
|
|
name: Build production
|
|
needs: dependencies
|
|
container: git.zakscode.com/ztimson/runner
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Restore node_modules
|
|
uses: actions/cache/restore@v3
|
|
with:
|
|
path: ./node_modules
|
|
key: node_modules
|
|
restore-keys: node_modules
|
|
|
|
- name: Build sources
|
|
run: npm run build:prod
|
|
|
|
- name: Compress artifacts
|
|
run: tar -czvf dist.tar.gz dist
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-prod
|
|
path: dist.tar.gz
|
|
|
|
docker:
|
|
name: Build docker image
|
|
needs: build-prod
|
|
container: git.zakscode.com/ztimson/runner
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download production build
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-prod
|
|
path: dist.tar.gz
|
|
|
|
- name: Extract artifacts
|
|
run: tar -xzvf dist.tar.gz
|
|
|
|
- name: Build docker image
|
|
uses: ztimson/actions/docker/build@develop
|
|
|
|
- name: Push docker image
|
|
uses: ztimson/actions/docker/push@develop
|
|
with:
|
|
registry_pass: ${{secrets.DEPLOY_TOKEN}}
|