chore(deps): node version 22 for github actions, cache path #696
This file contains hidden or 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
| # build, publis and deploy an API docker image | |
| name: stage - build, publish & deploy docker image | |
| on: [push] | |
| jobs: | |
| setup: | |
| name: setup node.js | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| cache-dependency-path: ../../package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| push_to_registry: | |
| needs: setup | |
| name: push docker image to docker hub | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: check out the repo | |
| uses: actions/checkout@master | |
| - name: log in to docker hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: extract metadata (tags, labels) for docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: gendercomics/website-stage | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=tag | |
| flavor: | | |
| latest=true | |
| - name: build and push docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| file: ./Dockerfile | |
| build-args: VUE_APP_API_URL=https://api-stage.gendercomics.net/ | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| deploy_stage: | |
| needs: push_to_registry | |
| name: stage deployment to digitalocean.com | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: check out the repo | |
| uses: actions/checkout@master | |
| - name: deploy stage | |
| uses: alinz/ssh-scp-action@master | |
| with: | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| host: ${{ secrets.APP_HOST }} | |
| user: ${{ secrets.DEPLOY_USER }} | |
| # runs this on remove server | |
| ssh_before: | | |
| echo 'STAGE: deploying ${{ github.ref }}' | |
| cd /var/gendercomics/website | |
| ls -lath | |
| # then upload docker-compose.yml | |
| scp: | | |
| ./docker-compose.yml ${{ secrets.DEPLOY_USER }}@${{ secrets.APP_HOST }}:/var/gendercomics/website | |
| # then run these commands | |
| ssh_after: | | |
| echo 'running docker-compose' | |
| docker pull gendercomics/website-stage:latest | |
| cd /var/gendercomics/website | |
| docker-compose up -d gendercomics-website-stage | |
| echo 'DONE!!!' |