|
| 1 | +name: MonarcAppFO stage images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'stage' ] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + packages: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + publish-stage-images: |
| 13 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stage' |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: Set image names |
| 19 | + id: image_names |
| 20 | + run: | |
| 21 | + owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') |
| 22 | + repo=$(echo "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]') |
| 23 | + echo "app=ghcr.io/${owner}/${repo}" >> "$GITHUB_OUTPUT" |
| 24 | + echo "stats=ghcr.io/${owner}/${repo}-stats" >> "$GITHUB_OUTPUT" |
| 25 | +
|
| 26 | + - name: Set up Docker Buildx |
| 27 | + uses: docker/setup-buildx-action@v3 |
| 28 | + |
| 29 | + - name: Set up QEMU |
| 30 | + uses: docker/setup-qemu-action@v3 |
| 31 | + |
| 32 | + - name: Log in to GHCR |
| 33 | + uses: docker/login-action@v3 |
| 34 | + with: |
| 35 | + registry: ghcr.io |
| 36 | + username: ${{ github.actor }} |
| 37 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + |
| 39 | + - name: Docker metadata (app) |
| 40 | + id: meta_app_stage |
| 41 | + uses: docker/metadata-action@v5 |
| 42 | + with: |
| 43 | + images: ${{ steps.image_names.outputs.app }} |
| 44 | + tags: | |
| 45 | + type=raw,value=stage |
| 46 | + type=sha,prefix=stage- |
| 47 | + labels: | |
| 48 | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} |
| 49 | + org.opencontainers.image.revision=${{ github.sha }} |
| 50 | +
|
| 51 | + - name: Build and push app image (stage) |
| 52 | + uses: docker/build-push-action@v6 |
| 53 | + with: |
| 54 | + context: . |
| 55 | + file: ./Dockerfile |
| 56 | + push: true |
| 57 | + platforms: linux/amd64,linux/arm64 |
| 58 | + tags: ${{ steps.meta_app_stage.outputs.tags }} |
| 59 | + labels: ${{ steps.meta_app_stage.outputs.labels }} |
| 60 | + |
| 61 | + - name: Docker metadata (stats) |
| 62 | + id: meta_stats_stage |
| 63 | + uses: docker/metadata-action@v5 |
| 64 | + with: |
| 65 | + images: ${{ steps.image_names.outputs.stats }} |
| 66 | + tags: | |
| 67 | + type=raw,value=stage |
| 68 | + type=sha,prefix=stage- |
| 69 | + labels: | |
| 70 | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} |
| 71 | + org.opencontainers.image.revision=${{ github.sha }} |
| 72 | +
|
| 73 | + - name: Build and push stats image (stage) |
| 74 | + uses: docker/build-push-action@v6 |
| 75 | + with: |
| 76 | + context: . |
| 77 | + file: ./Dockerfile.stats |
| 78 | + push: true |
| 79 | + platforms: linux/amd64,linux/arm64 |
| 80 | + tags: ${{ steps.meta_stats_stage.outputs.tags }} |
| 81 | + labels: ${{ steps.meta_stats_stage.outputs.labels }} |
0 commit comments