chore: fix production deployment workflow #105
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: Publish Release | |
"on": | |
push: | |
branches: | |
- main | |
- '[0-9]+.*' | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
outputs: | |
releaseVersion: ${{ steps.release.outputs.releaseVersion }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install dependencies | |
run: | | |
npm ci --force | |
- name: Lint | |
run: | | |
npm run lint | |
- name: Release | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VITE_FIREBASE_PROJECT_ID=zksync-dapp-wallet-v2 \ | |
npx semantic-release || true | |
staging: | |
name: Deploy to Staging | |
runs-on: ubuntu-latest | |
needs: publish | |
if: ${{ github.ref == 'refs/heads/main' && needs.publish.outputs.releaseVersion != '' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download Dist package | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
version: "tags/v${{ needs.publish.outputs.releaseVersion }}" | |
file: "dist.zip" | |
target: "dist.zip" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Unzip Dist package | |
run: | | |
unzip dist.zip | |
- name: Update config | |
run: | | |
echo "window[\"##runtimeConfig\"] = { firebaseProjectId: \"staging-zksync-dapp-wallet-v2\", appEnvironment: \"staging\" };" > dist/config.js | |
- name: Deploy | |
uses: matter-labs/action-hosting-deploy@main | |
id: deploy | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_STAGING_ZKSYNC_DAPP_WALLET_V2 }}" | |
projectId: staging-zksync-dapp-wallet-v2 | |
channelID: live |