Skip to content

ci: add github action for cd #68

ci: add github action for cd

ci: add github action for cd #68

Workflow file for this run

name: Node.js
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
lint_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci --legacy-peer-deps
- run: npm run lint
- run: npm audit --omit=dev
continue-on-error: true
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci --legacy-peer-deps
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: living-images-viewer
path: dist
createRelease:
runs-on: ubuntu-latest
# TODO if: github.ref_name == 'main'
needs: [ lint_audit, build ]
steps:
- uses: actions/checkout@v3
- uses: cperezabo/[email protected]
- run: echo "VERSION=v$(git mkver next --format '{Docker}')" >> $GITHUB_ENV
- run: echo '${{ env.VERSION }}'
- uses: actions/download-artifact@v4
with:
name: living-images-viewer
path: living-images-viewer
- run: (cd living-images-viewer && zip -r ../living-images-viewer.zip . )
- uses: ncipollo/release-action@v1
with:
artifacts: 'living-images-viewer.zip'
tag: '${{ env.VERSION }}'
generateReleaseNotes: 'true'
deployToProduction:
runs-on: ubuntu-latest
# TODO if: github.ref_name == 'main'
needs: [ lint_audit, build, createRelease ]
steps:
- uses: actions/download-artifact@v4
with:
name: living-images-viewer
path: living-images-viewer
- run: sudo apt-get install -y lftp
- run: lftp -c "set net:timeout 10 ; set sftp:auto-confirm yes ; open -u ${{ secrets.FTP_KULTURSPHAERE_USERNAME }},${{ secrets.FTP_KULTURSPHAERE_PASSWORD }} ${{ secrets.FTP_KULTURSPHAERE_URL }}/${{ secrets.FTP_KULTURSPHAERE_PATH_TEST_ROOT }} ; mirror -e -R -p living-images-viewer . ; quit"