Enabled Renovate #13
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: | |
| version: | |
| name: Version | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| playwright_version: ${{ steps.playwright.outputs.version }} | |
| docker_label: ${{ steps.docker.outputs.label }} | |
| git_tag: ${{ steps.git.outputs.tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Extract Playwright version | |
| id: playwright | |
| run: | | |
| extracted_version=$(node -p "require('./playwright-installer/package.json').dependencies['@playwright/test']") | |
| echo "version=$extracted_version" >> $GITHUB_OUTPUT | |
| - name: Extract Ubuntu distro codename | |
| id: distro | |
| run: | | |
| from_line=$(grep '^FROM' Dockerfile) | |
| # Extract the tag part after 'ubuntu:' and before '@' or end of line | |
| extracted_codename=$(echo "$from_line" | sed -n 's/^FROM ubuntu:\([^@]*\).*/\1/p') | |
| # Fallback to default if not found | |
| codename=${extracted_codename:-noble} | |
| echo "codename=$codename" >> $GITHUB_OUTPUT | |
| - name: Determine Docker label | |
| id: docker | |
| run: | | |
| label="v${{ steps.playwright.outputs.version }}-${{ steps.distro.outputs.codename }}" | |
| echo "label=$label" >> $GITHUB_OUTPUT | |
| - name: Determine Git tag | |
| id: git | |
| run: | | |
| COMMIT_SHA=${GITHUB_SHA::7} | |
| tag="${{ steps.docker.outputs.label }}-${COMMIT_SHA}" | |
| echo "tag=$tag" >> $GITHUB_OUTPUT | |
| - name: Summary | |
| run: | | |
| echo "Playwright version: ${{ steps.playwright.outputs.version }}" | |
| echo "Docker label: ${{ steps.docker.outputs.label }}" | |
| echo "Git tag: ${{ steps.git.outputs.tag }}" | |
| build-test-publish: | |
| name: "Build -> Test -> Publish" | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - version | |
| 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: 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 | |
| - name: Push image | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| tags: ghcr.io/serenity-js/playwright:${{ needs.version.outputs.docker_label }} | |
| tag: | |
| name: "Tag repository" | |
| runs-on: "ubuntu-24.04" | |
| if: github.ref == 'refs/heads/main' | |
| needs: | |
| - version | |
| - build-test-publish | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Push Git tag | |
| env: | |
| TAG_NAME: ${{ needs.version.outputs.git_tag }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "Creating Git tag $TAG_NAME" | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag $TAG_NAME | |
| git push origin $TAG_NAME |