Use overridable user and group ids #3
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: Main | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| types: [ opened, synchronize ] | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-test-publish: | |
| name: "Build -> Test -> Publish" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Docker BuildX | |
| uses: docker/setup-buildx-action@v3.11.1 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Playwright version | |
| id: playwright_version | |
| run: | | |
| version=$(node -p "require('./playwright-installer/package.json').dependencies['@playwright/test']") | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Get Ubuntu distro codename from Dockerfile | |
| id: distro | |
| run: | | |
| from_line=$(grep '^FROM' Dockerfile) | |
| # Extract the tag part after 'ubuntu:' and before '@' or end of line | |
| distro=$(echo "$from_line" | sed -n 's/^FROM ubuntu:\([^@]*\).*/\1/p') | |
| # Fallback to default if not found | |
| distro=${distro:-noble} | |
| echo "distro=$distro" >> $GITHUB_OUTPUT | |
| - name: Set image tag | |
| id: tag | |
| run: | | |
| tag="v${{ steps.playwright_version.outputs.version }}-${{ steps.distro.outputs.distro }}" | |
| echo "tag=$tag" >> $GITHUB_OUTPUT | |
| - name: Build image | |
| id: build | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| tags: serenity-js:latest | |
| load: true | |
| push: false | |
| - name: Test image | |
| run: | | |
| docker run --rm serenity-js:latest whoami | |
| docker run --rm serenity-js:latest node --version | |
| docker run --rm serenity-js:latest java --version | |
| docker run --rm serenity-js:latest google-chrome --version | |
| docker run --rm serenity-js:latest microsoft-edge --version |