|
| 1 | +name: PR -> Docker build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + version: [ 20.14.0-alpine ] |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + - name: Setup QEmu |
| 16 | + uses: docker/setup-qemu-action@v3 |
| 17 | + - name: Setup Docker buildx |
| 18 | + uses: docker/setup-buildx-action@v3 |
| 19 | + - name: Docker meta configuration |
| 20 | + uses: docker/metadata-action@v5 |
| 21 | + id: meta |
| 22 | + with: |
| 23 | + images: | |
| 24 | + unleashorg/unleash-server |
| 25 | + tags: | |
| 26 | + # only enabled for workflow dispatch except main (assume its a release): |
| 27 | + type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }} |
| 28 | + type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }} |
| 29 | + type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }} |
| 30 | + # only enabled in main: |
| 31 | + type=edge,prefix=main-,suffix=-${{ matrix.version }},enable=${{ github.ref == 'refs/heads/main' }} |
| 32 | + # only enabled on workflow_dispatch: |
| 33 | + type=sha,suffix=-${{ matrix.version }},enable=${{ github.event_name == 'workflow_dispatch' }} |
| 34 | + - name: Login to docker hub |
| 35 | + uses: docker/login-action@v3 |
| 36 | + with: |
| 37 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 38 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 39 | + - name: Build tag and push image to Docker hub |
| 40 | + uses: docker/build-push-action@v5 |
| 41 | + with: |
| 42 | + context: . |
| 43 | + platforms: linux/amd64,linux/arm64 |
| 44 | + push: false |
| 45 | + tags: ${{ steps.meta.outputs.tags }} |
| 46 | + labels: ${{ steps.meta.outputs.labels }} |
| 47 | + build-args: NODE_VERSION=${{ matrix.version }} |
0 commit comments