|
| 1 | +name: 🚀 Deploy |
| 2 | +concurrency: |
| 3 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 4 | + cancel-in-progress: true |
| 5 | + |
| 6 | +permissions: |
| 7 | + actions: read |
| 8 | + contents: read |
| 9 | + id-token: write |
| 10 | + packages: write |
| 11 | + attestations: write |
| 12 | + |
| 13 | +on: |
| 14 | + pull_request: |
| 15 | + types: [opened, synchronize, reopened] |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - master |
| 19 | + - next_release/* |
| 20 | + - release/* |
| 21 | + |
| 22 | +env: |
| 23 | + CONTAINER_NAME: ubiqube/msa2-php-sdk-installer |
| 24 | + REVIEWERS: msa-api |
| 25 | + |
| 26 | +jobs: |
| 27 | + deploy: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + - name: Set up Docker Buildx |
| 32 | + uses: docker/setup-buildx-action@v3 |
| 33 | + |
| 34 | + - name: Login to GitHub Container Registry |
| 35 | + uses: docker/login-action@v3 |
| 36 | + |
| 37 | + - name: Docker meta |
| 38 | + id: meta |
| 39 | + uses: docker/metadata-action@v5 |
| 40 | + with: |
| 41 | + images: "${{ env.CONTAINER_NAME }}" |
| 42 | + tags: | |
| 43 | + type=sha,format=long |
| 44 | + latest |
| 45 | +
|
| 46 | + - name: Build Docker image and publish to Docker Hub |
| 47 | + id: push |
| 48 | + uses: docker/build-push-action@v6 |
| 49 | + with: |
| 50 | + context: . |
| 51 | + push: ${{ github.event_name != 'pull_request' }} |
| 52 | + provenance: mode=max |
| 53 | + sbom: true |
| 54 | + tags: "${{ steps.meta.outputs.tags }}" |
| 55 | + labels: ${{ steps.meta.outputs.labels }} |
| 56 | + |
| 57 | + - name: Set latest commit message as env variable |
| 58 | + run: echo "LATEST_COMMIT_MESSAGE=$(git log -1 --oneline ${{ github.event.after }} | sed 's/"/\\"/g')" >> $GITHUB_ENV |
| 59 | + |
| 60 | + - name: Notify msa-docker repo about updated ${{ env.CONTAINER_NAME }} Docker image |
| 61 | + uses: benc-uk/workflow-dispatch@v1 |
| 62 | + with: |
| 63 | + token: ${{ secrets.MSA_DOCKER_REPO_ACCESS_TOKEN }} |
| 64 | + ref: ${{ github.ref_name || 'master' }} |
| 65 | + repo: ubiqube/msa-docker |
| 66 | + workflow: create-pr.yml |
| 67 | + inputs: |- |
| 68 | + { |
| 69 | + "image_name": "${{ env.CONTAINER_NAME }}", |
| 70 | + "image_tag": "sha-${{ github.sha }}", |
| 71 | + "latest_commit_message": "${{ env.LATEST_COMMIT_MESSAGE }}", |
| 72 | + "team_reviewers": "${{ env.REVIEWERS }}", |
| 73 | + "branch_name": "${{ github.ref_name }}" |
| 74 | + } |
0 commit comments