@@ -12,55 +12,72 @@ permissions:
1212 packages : write
1313
1414jobs :
15- build-test-publish :
16- name : " Build -> Test -> Publish "
15+ version :
16+ name : Version
1717 runs-on : ubuntu-24.04
1818 outputs :
19- docker_tag : ${{ steps.tag.outputs.docker_tag }}
20- git_tag : ${{ steps.git_tag.outputs.git_tag }}
19+ playwright_version : ${{ steps.playwright.outputs.version }}
20+ docker_label : ${{ steps.docker.outputs.label }}
21+ git_tag : ${{ steps.git.outputs.tag }}
22+
2123 steps :
2224 - name : Checkout repository
2325 uses : actions/checkout@v5
2426
25- - name : Set up Docker BuildX
26- uses : docker/setup-buildx-action@v3.11.1
27-
28- - name : Log in to GitHub Container Registry
29- uses : docker/login-action@v3.6.0
30- with :
31- registry : ghcr.io
32- username : ${{ github.actor }}
33- password : ${{ secrets.GITHUB_TOKEN }}
34-
3527 - name : Extract Playwright version
36- id : playwright_version
28+ id : playwright
3729 run : |
38- version =$(node -p "require('./playwright-installer/package.json').dependencies['@playwright/test']")
39- echo "version=$version " >> $GITHUB_OUTPUT
30+ extracted_version =$(node -p "require('./playwright-installer/package.json').dependencies['@playwright/test']")
31+ echo "version=$extracted_version " >> $GITHUB_OUTPUT
4032
41- - name : Get Ubuntu distro codename from Dockerfile
33+ - name : Extract Ubuntu distro codename
4234 id : distro
4335 run : |
4436 from_line=$(grep '^FROM' Dockerfile)
4537 # Extract the tag part after 'ubuntu:' and before '@' or end of line
46- distro =$(echo "$from_line" | sed -n 's/^FROM ubuntu:\([^@]*\).*/\1/p')
38+ extracted_codename =$(echo "$from_line" | sed -n 's/^FROM ubuntu:\([^@]*\).*/\1/p')
4739 # Fallback to default if not found
48- distro =${distro :-noble}
49- echo "distro=$distro " >> $GITHUB_OUTPUT
40+ codename =${extracted_codename :-noble}
41+ echo "codename=$codename " >> $GITHUB_OUTPUT
5042
51- - name : Set image tag
52- id : docker_tag
43+ - name : Determine Docker label
44+ id : docker
5345 run : |
54- docker_tag ="v${{ steps.playwright_version .outputs.version }}-${{ steps.distro.outputs.distro }}"
55- echo "docker_tag=$docker_tag " >> $GITHUB_OUTPUT
46+ label ="v${{ steps.playwright .outputs.version }}-${{ steps.distro.outputs.codename }}"
47+ echo "label=$label " >> $GITHUB_OUTPUT
5648
57- - name : Set Git tag
58- if : github.ref == 'refs/heads/main'
59- id : git_tag
49+ - name : Determine Git tag
50+ id : git
6051 run : |
6152 COMMIT_SHA=${GITHUB_SHA::7}
62- git_tag="${{ steps.tag.outputs.tag }}-${COMMIT_SHA}"
63- echo "git_tag=$git_tag" >> $GITHUB_OUTPUT
53+ tag="${{ steps.docker.outputs.label }}-${COMMIT_SHA}"
54+ echo "tag=$tag" >> $GITHUB_OUTPUT
55+
56+ - name : Summary
57+ run : |
58+ echo "Playwright version: ${{ steps.playwright.outputs.version }}"
59+ echo "Docker label: ${{ steps.docker.outputs.label }}"
60+ echo "Git tag: ${{ steps.git.outputs.tag }}"
61+
62+ build-test-publish :
63+ name : " Build -> Test -> Publish"
64+ runs-on : ubuntu-24.04
65+ needs :
66+ - version
67+
68+ steps :
69+ - name : Checkout repository
70+ uses : actions/checkout@v5
71+
72+ - name : Set up Docker BuildX
73+ uses : docker/setup-buildx-action@v3.11.1
74+
75+ - name : Log in to GitHub Container Registry
76+ uses : docker/login-action@v3.6.0
77+ with :
78+ registry : ghcr.io
79+ username : ${{ github.actor }}
80+ password : ${{ secrets.GITHUB_TOKEN }}
6481
6582 - name : Build image
6683 id : build
@@ -85,13 +102,17 @@ jobs:
85102 with :
86103 context : .
87104 push : true
88- tags : ghcr.io/serenity-js/playwright:${{ steps.tag .outputs.docker_tag }}
105+ tags : ghcr.io/serenity-js/playwright:${{ needs.version .outputs.docker_label }}
89106
90107 tag :
91108 name : " Tag repository"
92109 runs-on : " ubuntu-24.04"
93- needs : build-test-publish
94110 if : github.ref == 'refs/heads/main'
111+
112+ needs :
113+ - version
114+ - build-test-publish
115+
95116 permissions :
96117 contents : write
97118 id-token : write
@@ -102,7 +123,7 @@ jobs:
102123
103124 - name : Push Git tag
104125 env :
105- TAG_NAME : ${{ needs.build-test-publish .outputs.git_tag }}
126+ TAG_NAME : ${{ needs.version .outputs.git_tag }}
106127 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107128 run : |
108129 echo "Creating Git tag $TAG_NAME"
0 commit comments