|
1 |
| -name: Build container |
| 1 | +--- |
| 2 | +name: Build deployment container |
2 | 3 | on:
|
3 | 4 | push:
|
4 | 5 | branches:
|
5 |
| - - master |
6 |
| - - staging |
7 | 6 | - prod
|
8 |
| - pull_request: |
9 |
| - branches: |
10 |
| - - master |
| 7 | + - staging |
11 | 8 | workflow_dispatch:
|
12 | 9 | jobs:
|
13 | 10 | docker:
|
14 | 11 | runs-on: ubuntu-22.04
|
15 |
| - name: Docker Build and Push |
| 12 | + name: Docker push SHA |
16 | 13 | steps:
|
17 | 14 | - uses: actions/checkout@v4
|
| 15 | + - name: docker build |
| 16 | + run: docker build . -t metacpan/metacpan-ingest:$GITHUB_SHA |
| 17 | + - name: run Perl tests |
| 18 | + run: docker compose run ingest_test env PLACK_ENV=dev prove -lrv --jobs 2 t |
18 | 19 | - name: Log in to Docker Hub
|
19 | 20 | uses: docker/login-action@v3
|
20 | 21 | with:
|
21 | 22 | username: ${{ secrets.DOCKER_HUB_USER }}
|
22 | 23 | password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
23 |
| - - name: Set up Docker Buildx |
24 |
| - uses: docker/setup-buildx-action@v3 |
25 |
| - - name: Generate Auth Token |
26 |
| - uses: actions/create-github-app-token@v1 |
27 |
| - id: app-token |
28 |
| - with: |
29 |
| - app-id: ${{ secrets.APP_ID }} |
30 |
| - private-key: ${{ secrets.APP_PRIVATE_KEY }} |
31 |
| - - name: Build test image |
32 |
| - id: docker-build-test |
33 |
| - uses: docker/build-push-action@v5 |
34 |
| - with: |
35 |
| - target: test |
36 |
| - push: false |
37 |
| - load: true |
38 |
| - cache-from: type=gha |
39 |
| - cache-to: type=gha,mode=max |
40 |
| - - name: Run Perl tests |
41 |
| - run: docker run -i ${{ steps.docker-build-test.outputs.imageid }} |
42 |
| - - name: Docker meta |
43 |
| - id: meta |
44 |
| - uses: docker/metadata-action@v5 |
45 |
| - with: |
46 |
| - images: ${{ github.repository }} |
47 |
| - flavor: | |
48 |
| - latest=false |
49 |
| - tags: | |
50 |
| - type=sha,format=long,priority=1000 |
51 |
| - type=ref,event=branch |
52 |
| - type=ref,event=pr |
53 |
| - type=raw,value=latest,enable={{is_default_branch}} |
54 |
| - - name: Build and push |
55 |
| - uses: docker/build-push-action@v5 |
56 |
| - with: |
57 |
| - push: true |
58 |
| - tags: ${{ steps.meta.outputs.tags }} |
59 |
| - annotations: ${{ steps.meta.outputs.annotations }} |
60 |
| - cache-from: type=gha |
61 |
| - cache-to: type=gha,mode=max |
| 24 | + - name: push build to Docker hub |
| 25 | + run: docker push metacpan/metacpan-ingest:$GITHUB_SHA |
0 commit comments