fix property redirection #1880
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: Build and push images to registry | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| no_cache: | |
| description: 'Force a rebuild of the Docker images without using cache.' | |
| required: false | |
| type: boolean | |
| default: false | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| PUSH_IMAGE: ${{ github.event_name != 'pull_request' }} | |
| jobs: | |
| build-staging: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| single-tag: ${{ steps.single-tag.outputs.single-tag }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| if: env.PUSH_IMAGE == 'true' | |
| uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for staging | |
| id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/mardi4nfdi/wikibase-staging | |
| tags: | | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| labels: | | |
| org.opencontainers.image.description=Mediawiki/Wikibase image for the staging MaRDI portal | |
| org.opencontainers.image.title=Staging Wikibase image | |
| annotations: | | |
| org.opencontainers.image.description=Mediawiki/Wikibase image for the staging MaRDI portal | |
| org.opencontainers.image.title=Staging Wikibase image | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push staging image | |
| uses: docker/[email protected] | |
| with: | |
| context: . | |
| push: ${{ env.PUSH_IMAGE }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| build-args: | | |
| ENVIRONMENT=staging | |
| cache-from: type=gha,scope=staging | |
| cache-to: type=gha,mode=max,scope=staging | |
| - name: Set single tag output | |
| id: single-tag | |
| run: | | |
| echo "single-tag=ghcr.io/mardi4nfdi/wikibase-staging:latest" >> $GITHUB_OUTPUT | |
| build-jobrunner-staging: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: build-staging | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| if: env.PUSH_IMAGE == 'true' | |
| uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for jobrunner staging | |
| id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/mardi4nfdi/redis-jobrunner-staging | |
| tags: | | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| labels: | | |
| org.opencontainers.image.description=Redis jobrunner for Mediawiki/Wikibase staging environment | |
| org.opencontainers.image.title=Redis Jobrunner (staging) | |
| annotations: | | |
| org.opencontainers.image.description=Redis jobrunner for Mediawiki/Wikibase staging environment | |
| org.opencontainers.image.title=Redis Jobrunner (staging) | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push Docker jobrunner image | |
| uses: docker/[email protected] | |
| with: | |
| context: jobrunner | |
| push: ${{ env.PUSH_IMAGE }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| build-args: | | |
| BASE_IMAGE=${{ needs.build-staging.outputs.single-tag }} | |
| cache-from: type=gha,scope=jobrunner-staging | |
| cache-to: type=gha,mode=max,scope=jobrunner-staging | |
| build-production: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| single-tag: ${{ steps.single-tag.outputs.single-tag }} | |
| steps: | |
| - name: Start Measurement | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: start-measurement | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Checkout Repo Measurement | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: get-measurement | |
| label: 'repo checkout' | |
| - name: Log in to the Container registry | |
| uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for production | |
| id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/mardi4nfdi/wikibase-production | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| labels: | | |
| org.opencontainers.image.description=Mediawiki/Wikibase production-ready image for the MaRDI portal | |
| org.opencontainers.image.title=MaRDI Portal Mediawiki/Wikibase image for Kubernetes | |
| annotations: | | |
| org.opencontainers.image.description=Mediawiki/Wikibase production-ready image for the MaRDI portal | |
| org.opencontainers.image.title=MaRDI Portal Mediawiki/Wikibase image for Kubernetes | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push production image | |
| uses: docker/[email protected] | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| build-args: | | |
| ENVIRONMENT=production | |
| cache-from: type=gha,scope=production | |
| cache-to: type=gha,mode=max,scope=production | |
| - name: Set single tag output | |
| id: single-tag | |
| run: | | |
| echo "single-tag=${{ fromJSON(steps.meta.outputs.json).tags[0] }}" >> $GITHUB_OUTPUT | |
| - name: Tests measurement | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: get-measurement | |
| label: 'build and push' | |
| - name: Show Energy Results | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: display-results | |
| build-jobrunner-production: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: build-production | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for jobrunner production | |
| id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/mardi4nfdi/redis-jobrunner-production | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| labels: | | |
| org.opencontainers.image.description=Redis jobrunner for Mediawiki/Wikibase production environment | |
| org.opencontainers.image.title=Redis Jobrunner (production) | |
| annotations: | | |
| org.opencontainers.image.description=Redis jobrunner for Mediawiki/Wikibase production environment | |
| org.opencontainers.image.title=Redis Jobrunner (production) | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push jobrunner production image | |
| uses: docker/[email protected] | |
| with: | |
| context: jobrunner | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| build-args: | | |
| BASE_IMAGE=${{ needs.build-production.outputs.single-tag }} | |
| cache-from: type=gha,scope=jobrunner-production | |
| cache-to: type=gha,mode=max,scope=jobrunner-production | |
| build-apache: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| if: env.PUSH_IMAGE == 'true' | |
| uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/mardi4nfdi/apache | |
| tags: | | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| labels: | | |
| org.opencontainers.image.description=Apache reverse proxy for Mediawiki/Wikibase | |
| org.opencontainers.image.title=Apache Proxy | |
| annotations: | | |
| org.opencontainers.image.description=Apache reverse proxy for Mediawiki/Wikibase | |
| org.opencontainers.image.title=Apache Proxy | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push Apache image | |
| uses: docker/[email protected] | |
| with: | |
| context: apache | |
| push: ${{ env.PUSH_IMAGE }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| cache-from: type=gha,scope=apache | |
| cache-to: type=gha,mode=max,scope=apache | |
| build-dev: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: build-staging | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| if: env.PUSH_IMAGE == 'true' | |
| uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for dev | |
| id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/mardi4nfdi/wikibase-dev | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| labels: | | |
| org.opencontainers.image.title=Wikibase Development | |
| org.opencontainers.image.description=Wikibase development environment with additional tools | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push Docker dev image | |
| uses: docker/[email protected] | |
| with: | |
| context: dev | |
| push: ${{ env.PUSH_IMAGE }} | |
| tags: ${{ env.REGISTRY }}/mardi4nfdi/wikibase-dev:latest | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.labels }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| build-args: | | |
| BASE_IMAGE=${{ needs.build-staging.outputs.single-tag }} | |
| cache-from: type=gha,scope=dev | |
| cache-to: type=gha,mode=max,scope=dev |