chore: Update CI workflow to deploy dev environment using FTP #1
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: React Native CI/CD | |
on: | |
push: | |
branches: main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- run: cd app && npm ci | |
# - run: cd app && npm test | |
publish-artifact: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: https://npm.pkg.github.com/ | |
- run: cd app && npm ci | |
- run: cd app && npx expo export --platform web | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: | | |
app/dist | |
!app/dist/**/*.md | |
deploy-dev: | |
name: π Deploy dev | |
environment: dev | |
needs: publish-artifact | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Get latest code from artifact dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: artifacts | |
- name: π Unzip artifact | |
run: unzip artifacts/*.zip -d dist | |
- name: π Sync files | |
uses: SamKirkland/[email protected] | |
with: | |
local-dir: dist/ | |
server: ${{ secrets.FTP_SERVER }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} |