Skip to content

Commit

Permalink
patch:Fix Continuous Deployment of Frontera, in prod (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviuOpenline authored Feb 21, 2025
1 parent 2654ebe commit 130f01f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,43 @@ jobs:
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
github.event_name == 'workflow_dispatch'
steps:
- name: Get workflow output
id: workflow_output
if: github.event_name == 'workflow_run'
uses: actions/github-script@v6
with:
script: |
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
const matchArtifact = allArtifacts.data.artifacts.find((artifact) => {
return artifact.name == "workflow-data"
});
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
fs.writeFileSync('workflow-data.zip', Buffer.from(download.data));
const execSync = require('child_process').execSync;
execSync('unzip workflow-data.zip');
const workflowData = JSON.parse(fs.readFileSync('workflow-data.json', 'utf8'));
core.setOutput('next_version', workflowData.next_version);
- name: Set version
id: set_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${{ github.event.workflow_run.outputs.next_version }}" >> $GITHUB_OUTPUT
echo "version=${{ steps.workflow_output.outputs.next_version }}" >> $GITHUB_OUTPUT
fi
- name: Trigger Frontera App Workflow
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,17 @@ jobs:
"VITE_CLIENT_APP_URL=${{ secrets.PROD_VITE_CLIENT_APP_URL }}"
"VITE_REALTIME_WS_PATH=${{ secrets.PROD_VITE_REALTIME_WS_PATH }}"
"VITE_REALTIME_WS_API_KEY=${{ secrets.PROD_VITE_REALTIME_WS_API_KEY }}"
"VITE_STRIPE_PUBLIC_KEY=${{ secrets.PROD_VITE_STRIPE_PUBLIC_KEY }}"
"VITE_STRIPE_PUBLIC_KEY=${{ secrets.PROD_VITE_STRIPE_PUBLIC_KEY }}"
# Save outputs for the deploy workflow
- name: Save workflow outputs
if: steps.generate_version.outputs.should_release == 'true'
run: |
echo "{\"next_version\": \"${{ steps.generate_version.outputs.next_version }}\"}" > workflow-data.json
- name: Upload workflow outputs
if: steps.generate_version.outputs.should_release == 'true'
uses: actions/upload-artifact@v3
with:
name: workflow-data
path: workflow-data.json

0 comments on commit 130f01f

Please sign in to comment.