|
| 1 | +name: Docker Image Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +env: |
| 7 | + ORG: stackmon |
| 8 | + PROJECT: status-dashboard-v3-front |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + if: github.event.pull_request.merged == false |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Docker meta |
| 19 | + id: meta |
| 20 | + uses: docker/metadata-action@v5 |
| 21 | + with: |
| 22 | + images: | |
| 23 | + "${{ secrets.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}" |
| 24 | + tags: | |
| 25 | + type=schedule |
| 26 | + type=ref,event=branch |
| 27 | + type=ref,event=pr |
| 28 | + type=semver,pattern={{version}} |
| 29 | + type=semver,pattern={{major}}.{{minor}} |
| 30 | + type=semver,pattern={{major}} |
| 31 | + type=sha |
| 32 | +
|
| 33 | + - name: Set up Docker Buildx |
| 34 | + uses: docker/setup-buildx-action@v3 |
| 35 | + |
| 36 | + - name: Build and push |
| 37 | + uses: docker/build-push-action@v6 |
| 38 | + with: |
| 39 | + context: . |
| 40 | + tags: ${{ steps.meta.outputs.tags }} |
| 41 | + labels: ${{ steps.meta.outputs.labels }} |
| 42 | + push: false |
| 43 | + secrets: | |
| 44 | + SD_BACKEND_URL=${{ secrets.SD_BACKEND_URL }} |
| 45 | + SD_CLIENT_ID=${{ secrets.SD_CLIENT_ID }} |
| 46 | + SD_AUTHORITY_URL=${{ secrets.SD_AUTHORITY_URL }} |
| 47 | +
|
| 48 | + push_manual: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Docker meta |
| 55 | + id: meta |
| 56 | + uses: docker/metadata-action@v5 |
| 57 | + with: |
| 58 | + images: | |
| 59 | + "${{ secrets.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}" |
| 60 | + tags: | |
| 61 | + type=schedule |
| 62 | + type=ref,event=branch |
| 63 | + type=ref,event=pr |
| 64 | + type=semver,pattern={{version}} |
| 65 | + type=semver,pattern={{major}}.{{minor}} |
| 66 | + type=semver,pattern={{major}} |
| 67 | + type=sha |
| 68 | +
|
| 69 | + - name: Set up Docker Buildx |
| 70 | + uses: docker/setup-buildx-action@v3 |
| 71 | + |
| 72 | + - name: Login to Container Registry |
| 73 | + uses: docker/login-action@v3 |
| 74 | + with: |
| 75 | + registry: ${{ secrets.REGISTRY }} |
| 76 | + username: ${{ secrets.REGISTRY_USER }} |
| 77 | + password: ${{ secrets.REGISTRY_PASSWORD }} |
| 78 | + |
| 79 | + - name: Build and push |
| 80 | + uses: docker/build-push-action@v6 |
| 81 | + with: |
| 82 | + context: . |
| 83 | + tags: ${{ steps.meta.outputs.tags }} |
| 84 | + labels: ${{ steps.meta.outputs.labels }} |
| 85 | + push: true |
| 86 | + secrets: | |
| 87 | + SD_BACKEND_URL=${{ secrets.SD_BACKEND_URL }} |
| 88 | + SD_CLIENT_ID=${{ secrets.SD_CLIENT_ID }} |
| 89 | + SD_AUTHORITY_URL=${{ secrets.SD_AUTHORITY_URL }} |
0 commit comments