|
| 1 | +name: Container release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + |
| 10 | + pull_request: |
| 11 | + |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: {} |
| 15 | + |
| 16 | +jobs: |
| 17 | + frontend: |
| 18 | + name: Build/release frontend container |
| 19 | + runs-on: ubuntu-latest |
| 20 | + permissions: |
| 21 | + packages: write |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - uses: docker/setup-buildx-action@v3 |
| 25 | + - uses: docker/login-action@v3 |
| 26 | + with: |
| 27 | + registry: ghcr.io |
| 28 | + username: ${{ github.actor }} |
| 29 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + - uses: docker/metadata-action@v5 |
| 31 | + id: metadata |
| 32 | + with: |
| 33 | + images: ghcr.io/esgf2-us/metagrid-frontend |
| 34 | + tags: | |
| 35 | + type=semver,pattern={{version}} |
| 36 | + - uses: docker/build-push-action@v4 |
| 37 | + with: |
| 38 | + cache-from: type=gha |
| 39 | + cache-to: type=gha,mode=max |
| 40 | + context: frontend/ |
| 41 | + file: frontend/docker/production/react/Dockerfile |
| 42 | + push: ${{ github.event_name != 'pull_request' }} |
| 43 | + tags: ${{ steps.metadata.outputs.tags }} |
| 44 | + labels: ${{ steps.metadata.outputs.labels }} |
| 45 | + backend: |
| 46 | + name: Build/release backend container |
| 47 | + runs-on: ubuntu-latest |
| 48 | + permissions: |
| 49 | + packages: write |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + - uses: docker/setup-buildx-action@v3 |
| 53 | + - uses: docker/login-action@v3 |
| 54 | + with: |
| 55 | + registry: ghcr.io |
| 56 | + username: ${{ github.actor }} |
| 57 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + - uses: docker/metadata-action@v5 |
| 59 | + id: metadata |
| 60 | + with: |
| 61 | + images: ghcr.io/esgf2-us/metagrid-backend |
| 62 | + tags: | |
| 63 | + type=semver,pattern={{version}} |
| 64 | + - uses: docker/build-push-action@v4 |
| 65 | + with: |
| 66 | + cache-from: type=gha |
| 67 | + cache-to: type=gha,mode=max |
| 68 | + context: backend/ |
| 69 | + file: backend/docker/production/django/Dockerfile |
| 70 | + push: ${{ github.event_name != 'pull_request' }} |
| 71 | + tags: ${{ steps.metadata.outputs.tags }} |
| 72 | + labels: ${{ steps.metadata.outputs.labels }} |
0 commit comments