|
5 | 5 | branches: |
6 | 6 | - master |
7 | 7 |
|
8 | | -env: |
9 | | - REGISTRY: ghcr.io |
10 | | - IMAGE_NAME: ${{ github.repository }} |
11 | | - |
12 | 8 | jobs: |
13 | 9 | build-and-test: |
14 | 10 | runs-on: ubuntu-latest |
|
67 | 63 | with: |
68 | 64 | path: . |
69 | 65 | name: laravel-app |
70 | | - |
71 | | - publish: |
72 | | - needs: build-and-test |
73 | | - runs-on: ubuntu-latest |
74 | | - |
75 | | - permissions: |
76 | | - contents: read |
77 | | - packages: write |
78 | | - id-token: write |
79 | | - |
80 | | - steps: |
81 | | - # Download the build artifact |
82 | | - - name: Download a Build Artifact |
83 | | - |
84 | | - with: |
85 | | - name: laravel-app |
86 | | - |
87 | | - - name: Install cosign |
88 | | - if: github.event_name != 'pull_request' |
89 | | - uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 |
90 | | - with: |
91 | | - cosign-release: "v2.2.4" |
92 | | - |
93 | | - - name: Set up Docker Buildx |
94 | | - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 |
95 | | - |
96 | | - - name: Log into registry ${{ env.REGISTRY }} |
97 | | - if: github.event_name != 'pull_request' |
98 | | - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d |
99 | | - with: |
100 | | - registry: ${{ env.REGISTRY }} |
101 | | - username: ${{ github.actor }} |
102 | | - password: ${{ secrets.GITHUB_TOKEN }} |
103 | | - |
104 | | - - name: Extract Docker metadata |
105 | | - id: meta |
106 | | - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 |
107 | | - with: |
108 | | - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
109 | | - |
110 | | - - name: Build and push Docker image |
111 | | - id: build-and-push |
112 | | - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 |
113 | | - with: |
114 | | - context: . |
115 | | - push: ${{ github.event_name != 'pull_request' }} |
116 | | - tags: ${{ steps.meta.outputs.tags }} |
117 | | - labels: ${{ steps.meta.outputs.labels }} |
118 | | - cache-from: type=gha |
119 | | - cache-to: type=gha,mode=max |
120 | | - |
121 | | - - name: Sign the published Docker image |
122 | | - if: ${{ github.event_name != 'pull_request' }} |
123 | | - env: |
124 | | - TAGS: ${{ steps.meta.outputs.tags }} |
125 | | - DIGEST: ${{ steps.build-and-push.outputs.digest }} |
126 | | - run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
127 | | - |
128 | | - # Build docker image |
129 | | - # - name: Build the Docker image |
130 | | - # run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) |
0 commit comments