Merge remote-tracking branch 'origin/feature/AB-02' into stage #9
This file contains hidden or 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: MonarcAppFO stage images | |
| on: | |
| push: | |
| branches: [ 'stage' ] | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| publish-stage-app-image: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/stage' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: install deps | |
| run: sudo apt-get update && sudo apt install -y gettext | |
| # PHP | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.1" | |
| tools: composer:v2.3 | |
| extensions: bcmath | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate | |
| - name: Install PHP dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest --no-dev | |
| - name: Symlink Monarc modules | |
| run: | | |
| mkdir -p module/Monarc | |
| ln -s ../../vendor/monarc/core module/Monarc/Core | |
| ln -s ../../vendor/monarc/frontoffice module/Monarc/FrontOffice | |
| # javascript | |
| - name: Use Node.js 16.x | |
| uses: actions/setup-node@v1 | |
| with: | |
| node-version: "16.x" | |
| - uses: oprypin/find-latest-tag@v1 | |
| with: | |
| repository: monarc-project/ng-anr | |
| releases-only: true | |
| id: ng_anr_lasttag | |
| - run: echo "ng-anr is at version ${{ steps.ng_anr_lasttag.outputs.tag }}" | |
| - name: Install ng-anr | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: monarc-project/ng-anr | |
| ref: ${{ steps.ng_anr_lasttag.outputs.tag }} | |
| path: './node_modules/ng_anr' | |
| - uses: oprypin/find-latest-tag@v1 | |
| with: | |
| repository: monarc-project/ng-client | |
| releases-only: true | |
| id: ng_client_lasttag | |
| - run: echo "ng-client is at version ${{ steps.ng_client_lasttag.outputs.tag }}" | |
| - name: Install ng-client | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: monarc-project/ng-client | |
| ref: ${{ steps.ng_client_lasttag.outputs.tag }} | |
| path: './node_modules/ng_client' | |
| - name: Install ng-client dependencies | |
| run: | | |
| cd node_modules/ng_client | |
| npm ci | |
| - name: post job | |
| run: | | |
| bash -ex ./scripts/link_modules_resources.sh | |
| bash -ex ./scripts/compile_translations.sh | |
| - name: Prepare app image build context | |
| run: | | |
| rm -rf .docker-stage-context | |
| mkdir -p .docker-stage-context | |
| tar \ | |
| --exclude .git \ | |
| --exclude .github \ | |
| --exclude .idea \ | |
| --exclude .vscode \ | |
| --exclude vagrant \ | |
| --exclude wsl \ | |
| --exclude INSTALL \ | |
| --exclude .env \ | |
| --exclude .env.dev \ | |
| --exclude .DS_Store \ | |
| --exclude .docker-stage-context \ | |
| --exclude .docker-release-context \ | |
| -cf - . | tar -xf - -C .docker-stage-context | |
| rm -rf .docker-stage-context/data | |
| rm -f .docker-stage-context/.dockerignore | |
| - name: Set image names | |
| id: image_names | |
| run: | | |
| owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') | |
| repo=$(echo "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]') | |
| echo "app=ghcr.io/${owner}/${repo}" >> "$GITHUB_OUTPUT" | |
| echo "stats=ghcr.io/${owner}/${repo}-stats" >> "$GITHUB_OUTPUT" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata (app) | |
| id: meta_app_stage | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ steps.image_names.outputs.app }} | |
| tags: | | |
| type=raw,value=stage | |
| type=sha,prefix=stage- | |
| labels: | | |
| org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| - name: Build and push app image (stage) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./.docker-stage-context | |
| file: ./.docker-stage-context/Dockerfile.release | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha,scope=stage-app-image | |
| cache-to: type=gha,mode=max,scope=stage-app-image | |
| tags: ${{ steps.meta_app_stage.outputs.tags }} | |
| labels: ${{ steps.meta_app_stage.outputs.labels }} | |
| publish-stage-stats-image: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/stage' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set image names | |
| id: image_names | |
| run: | | |
| owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') | |
| repo=$(echo "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]') | |
| echo "app=ghcr.io/${owner}/${repo}" >> "$GITHUB_OUTPUT" | |
| echo "stats=ghcr.io/${owner}/${repo}-stats" >> "$GITHUB_OUTPUT" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata (stats) | |
| id: meta_stats_stage | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ steps.image_names.outputs.stats }} | |
| tags: | | |
| type=raw,value=stage | |
| type=sha,prefix=stage- | |
| labels: | | |
| org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| - name: Build and push stats image (stage) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile.stats | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha,scope=stage-stats-image | |
| cache-to: type=gha,mode=max,scope=stage-stats-image | |
| tags: ${{ steps.meta_stats_stage.outputs.tags }} | |
| labels: ${{ steps.meta_stats_stage.outputs.labels }} |