Merge pull request #692 from FuelRats/dependabot/npm_and_yarn/nodemai… #78
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: Deploy | |
on: | |
push: | |
branches: [ develop, main ] | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install Dependencies | |
run: yarn install --immutable | |
- name: Build Project | |
run: yarn build | |
- name: Prepare artifact | |
run: | | |
tar -czf fr-api.tar.gz \ | |
.yarn/releases \ | |
dist \ | |
migrations \ | |
static \ | |
tools \ | |
views \ | |
.nvmrc \ | |
.sequelizerc \ | |
.yarnrc.yml \ | |
build.json \ | |
database_example.json \ | |
LICENSE.md \ | |
localisations.json \ | |
package.json \ | |
permissions.json \ | |
README.md \ | |
yarn.lock | |
- name: Publish artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fr-api | |
path: fr-api.tar.gz | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: publish | |
env: | |
NODE_ENV: production | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: fr-api | |
- name: Extract artifact | |
run: | | |
tar -xzf fr-api.tar.gz | |
rm fr-api.tar.gz | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.FR_SSH_KEY }} | |
known_hosts: ${{ secrets.FR_KNOWN_HOSTS }} | |
- name: Deploy | |
run: sh ./tools/deploy.sh |