fix(docker): try to pak install xml2 before setting cran repos #44
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: MapX CI/CD | |
on: | |
push: | |
branches: | |
- staging | |
workflow_dispatch: | |
schedule: | |
- cron: '0 7 * * 1' # Monday 7 AM UTC | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: bigproc | |
environment : ci | |
env: | |
SCHEDULED_BUILD: ${{ github.event_name == 'schedule' }} | |
PUSH_ENABLED: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
# Initialize and build all components | |
- name: Run CI process | |
run: | | |
echo "SDK directory contents:" | |
ls -la app/src/js/sdk/src/mapx_resolvers | |
echo "Running as user:" | |
whoami | |
npm run ci | |
# Docker setup (only if needed) | |
- name: Docker Login | |
if: env.PUSH_ENABLED == 'true' | |
uses: docker/#-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Get version from package.json for Docker tags | |
- name: Get version | |
id: version | |
run: echo "version=$(node -p "require('./app/package.json').version")" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build API Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./api | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ env.PUSH_ENABLED == 'true' }} | |
tags: | | |
fredmoser/mapx_api:${{ steps.version.outputs.version }} | |
${{ env.PUSH_ENABLED == 'true' && 'fredmoser/mapx_api:latest' || '' }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build APP Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./app | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ env.PUSH_ENABLED == 'true' }} | |
tags: | | |
fredmoser/mapx_app:${{ steps.version.outputs.version }} | |
${{ env.PUSH_ENABLED == 'true' && 'fredmoser/mapx_app:latest' || '' }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# Create issue on scheduled build failure | |
- name: Create Issue on Failure | |
if: failure() && env.SCHEDULED_BUILD == 'true' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const version = process.env.VERSION; | |
await github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: `🚨 Scheduled Build Failed - ${new Date().toISOString().split('T')[0]}`, | |
body: `The scheduled build for MapX has failed. | |
- Version: ${version} | |
- Workflow Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId} | |
Please check the workflow logs for more details.` | |
}); |