Skip to content

chore(release): promote dev to staging #145

chore(release): promote dev to staging

chore(release): promote dev to staging #145

Workflow file for this run

name: Release and Deploy
on:
push:
branches:
- dev
- staging
- main
pull_request:
types:
- closed
jobs:
release-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install requests
- name: Install Node.js dependencies
run: pnpm install --frozen-lockfile
- name: Release
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging'
run: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from package.json
id: get_version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Determine environment
id: get_environment
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "environment=production" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/staging" ]]; then
echo "environment=staging" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "environment=dev" >> $GITHUB_OUTPUT
fi
- name: Build distribution files
run: |
python3 scripts/build_dist.py \
--product all \
--version v${{ steps.get_version.outputs.version }} \
--environment ${{ steps.get_environment.outputs.environment }}
- name: Deploy to FTP
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ github.ref == 'refs/heads/main' && secrets.FTP_USERNAME_PROD || github.ref == 'refs/heads/staging' && secrets.FTP_USERNAME_STAGING || secrets.FTP_USERNAME_DEV }}
password: ${{ github.ref == 'refs/heads/main' && secrets.FTP_PASSWORD_PROD || github.ref == 'refs/heads/staging' && secrets.FTP_PASSWORD_STAGING || secrets.FTP_PASSWORD_DEV }}
local-dir: dist/
server-dir: /