Skip to content

Delivery

Delivery #92

Workflow file for this run

name: ci
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node env
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "npm"
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
- name: Run linter
run: npm run lint
build-docker-image:
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Read image identifiers
id: image
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- name: Build image
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ steps.image.outputs.lowercase }}:latest
ghcr.io/${{ steps.image.outputs.lowercase }}:${{ github.sha }}
build-args: |
- RELEASE=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: build-docker-image
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- name: Read image identifiers
id: image
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- name: Update production image
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: circle
key: ${{ secrets.DEPLOY_KEY }}
script: docker service update diploma-generator_backend --image ghcr.io/${{ steps.image.outputs.lowercase }}:${{ github.sha }} --with-registry-auth