Add max length validation for print job name field #63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Images | |
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| on: | |
| push: | |
| branches: [ master ] | |
| # Publish semver tags as releases. | |
| tags: [ 'v*.*.*' ] | |
| pull_request: | |
| branches: [ master ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| env: | |
| # Use docker.io for Docker Hub if empty | |
| REGISTRY: ghcr.io | |
| # github.repository as <account>/<repo> | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-source: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Prepare source code | |
| run: /bin/bash docker/build.sh | |
| - name: Compress source code directories | |
| run: | | |
| tar --create --gzip --verbose --file=build/php.tgz --directory=build/php . | |
| tar --create --gzip --verbose --file=build/nginx.tgz --directory=build/nginx . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: php | |
| path: build/php.tgz | |
| if-no-files-found: error | |
| retention-days: 3 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: nginx | |
| path: build/nginx.tgz | |
| if-no-files-found: error | |
| retention-days: 3 | |
| build-and-push-image: | |
| needs: build-source | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| target: | |
| - image: ghcr.io/kduma-oss/webprint-server/fpm | |
| name: fpm | |
| artifact: php | |
| - image: ghcr.io/kduma-oss/webprint-server/cron | |
| name: cron | |
| artifact: php | |
| - image: ghcr.io/kduma-oss/webprint-server/nginx | |
| name: nginx | |
| artifact: nginx | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ matrix.target.artifact }} | |
| path: build/ | |
| - name: Decompress source code artifact | |
| run: | | |
| mkdir -p build/${{ matrix.target.artifact }} | |
| tar --extract --gunzip --verbose --file=build/${{ matrix.target.artifact }}.tgz --directory=build/${{ matrix.target.artifact }} | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| working-directory: build/ | |
| # Workaround: https://github.com/docker/build-push-action/issues/461 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | |
| # Login against a Docker registry except on PR | |
| # https://github.com/docker/login-action | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Extract metadata (tags, labels) for Docker | |
| # https://github.com/docker/metadata-action | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
| with: | |
| images: ${{ matrix.target.image }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=ref,event=tag | |
| type=semver,pattern=v{{version}} | |
| type=semver,pattern=v{{major}}.{{minor}} | |
| type=semver,pattern=v{{major}} | |
| # Build and push Docker image with Buildx (don't push on PR) | |
| # https://github.com/docker/build-push-action | |
| - name: Build and push Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| target: ${{ matrix.target.name }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |