-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build Application | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
env_file: | ||
required: false | ||
type: boolean | ||
default: false | ||
secrets: | ||
DUBBING_API_BASE_URL: | ||
required: false | ||
TRANSCRIPTION_API_BASE_URL: | ||
required: false | ||
MATXA_API_BASE_URL: | ||
required: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Load .env.production | ||
if: inputs.env_file | ||
run: | | ||
echo "DUBBING_API_BASE_URL=$(grep DUBBING_API_BASE_URL .env.production | cut -d '=' -f2)" >> $GITHUB_ENV | ||
echo "TRANSCRIPTION_API_BASE_URL=$(grep TRANSCRIPTION_API_BASE_URL .env.production | cut -d '=' -f2)" >> $GITHUB_ENV | ||
echo "MATXA_API_BASE_URL=$(grep MATXA_API_BASE_URL .env.production | cut -d '=' -f2)" >> $GITHUB_ENV | ||
echo "APP_MODE=$(grep APP_MODE .env.production | cut -d '=' -f2)" >> $GITHUB_ENV | ||
echo "APP_LANGUAGE=$(grep APP_LANGUAGE .env.production | cut -d '=' -f2)" >> $GITHUB_ENV | ||
- name: Build | ||
run: npm run build:prod | ||
env: | ||
DUBBING_API_BASE_URL: ${{ inputs.env_file && env.DUBBING_API_BASE_URL || secrets.DUBBING_API_BASE_URL }} | ||
TRANSCRIPTION_API_BASE_URL: ${{ inputs.env_file && env.TRANSCRIPTION_API_BASE_URL || secrets.TRANSCRIPTION_API_BASE_URL }} | ||
MATXA_API_BASE_URL: ${{ inputs.env_file && env.MATXA_API_BASE_URL || secrets.MATXA_API_BASE_URL }} | ||
APP_MODE: ${{ inputs.env_file && env.APP_MODE || 'production' }} | ||
APP_LANGUAGE: ${{ inputs.env_file && env.APP_LANGUAGE || 'ca' }} | ||
|
||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Sync to WordPress Theme | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
secrets: | ||
DUBBING_API_BASE_URL: ${{ secrets.DUBBING_API_BASE_URL }} | ||
TRANSCRIPTION_API_BASE_URL: ${{ secrets.TRANSCRIPTION_API_BASE_URL }} | ||
MATXA_API_BASE_URL: ${{ secrets.MATXA_API_BASE_URL }} | ||
|
||
sync: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Find JS filename | ||
id: find-js | ||
run: | | ||
JS_FILE=$(find dist/assets -name "index-*.js" -type f) | ||
echo "js_file=$JS_FILE" >> $GITHUB_OUTPUT | ||
- name: Checkout wp-softcatala repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: Softcatala/wp-softcatala | ||
token: ${{ secrets.WP_REPO_TOKEN }} | ||
|
||
- name: Copy JS file | ||
run: | | ||
cp ${{ steps.find-js.outputs.js_file }} static/js/subdub-editor.js | ||
- name: Commit and push changes | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add static/js/subdub-editor.js | ||
git commit -m "Update subdub-editor.js to version ${{ github.event.release.tag_name }}" | ||
git push origin HEAD:master |