|
| 1 | +name: Pull Request Containers |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + types: [labeled, synchronize, opened] |
| 8 | + |
| 9 | +jobs: |
| 10 | + containers: |
| 11 | + name: Create containers |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + if: | |
| 15 | + contains(github.event.pull_request.labels.*.name, 'container') |
| 16 | +
|
| 17 | + permissions: |
| 18 | + id-token: write |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: linz/action-typescript@v3 |
| 24 | + |
| 25 | + - name: Bundle & Package all files |
| 26 | + run: | |
| 27 | + npx lerna run bundle --stream |
| 28 | + npm pack --workspaces |
| 29 | +
|
| 30 | + - name: Set up Docker Qemu |
| 31 | + id: qemu |
| 32 | + uses: docker/setup-qemu-action@v3 |
| 33 | + |
| 34 | + - name: Set up Docker Buildx |
| 35 | + id: buildx |
| 36 | + uses: docker/setup-buildx-action@v3 |
| 37 | + |
| 38 | + - name: Copy packages and files |
| 39 | + run: | |
| 40 | + # Files are packed into the base directory |
| 41 | + cp *.tgz packages/server/ |
| 42 | + cp *.tgz packages/cli/ |
| 43 | + cp -r packages/lambda-tiler/static/ packages/server/ |
| 44 | + cp -r packages/lambda-tiler/static/ packages/cli/ |
| 45 | +
|
| 46 | + - name: Login to GitHub Container Registry |
| 47 | + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.repository_owner }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + |
| 53 | + - name: '@basemaps/cli - Build and push cli PR container' |
| 54 | + uses: docker/build-push-action@v5 |
| 55 | + with: |
| 56 | + context: packages/cli |
| 57 | + platforms: linux/arm64,linux/amd64 |
| 58 | + tags: 'ghcr.io/${{ github.repository }}/cli:pr-${{ github.event.number }}' |
| 59 | + push: true |
| 60 | + |
| 61 | + - name: '@basemaps/server - Build and push server PR container' |
| 62 | + uses: docker/build-push-action@v5 |
| 63 | + with: |
| 64 | + context: packages/server |
| 65 | + platforms: linux/arm64,linux/amd64 |
| 66 | + tags: ghcr.io/${{ github.repository }}/server:pr-${{ github.event.number }} |
| 67 | + push: true |
0 commit comments