|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 1 * * *' |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + get-version: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + src_version: ${{ steps.retrieve-src-version.outputs.release }} |
| 16 | + current_version: ${{ steps.retrieve-current-version.outputs.release }} |
| 17 | + steps: |
| 18 | + - id: retrieve-src-version |
| 19 | + uses: pozetroninc/github-action-get-latest-release@master |
| 20 | + with: |
| 21 | + owner: microsoft |
| 22 | + repo: playwright |
| 23 | + excludes: prerelease, draft |
| 24 | + |
| 25 | + - id: retrieve-current-version |
| 26 | + uses: pozetroninc/github-action-get-latest-release@master |
| 27 | + with: |
| 28 | + owner: ecmchow |
| 29 | + repo: playwright-pnpm |
| 30 | + excludes: prerelease, draft |
| 31 | + |
| 32 | + build-images: |
| 33 | + name: Build Linux Images |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: get-version |
| 36 | + if: needs.get-version.outputs.src_version != needs.get-version.outputs.current_version |
| 37 | + strategy: |
| 38 | + max-parallel: 2 |
| 39 | + matrix: |
| 40 | + arch: [amd64, arm64] |
| 41 | + os: [focal, jammy] |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v3 |
| 45 | + |
| 46 | + - name: Set up QEMU |
| 47 | + uses: docker/setup-qemu-action@v2 |
| 48 | + |
| 49 | + - name: Set up Docker Buildx |
| 50 | + uses: docker/setup-buildx-action@v2 |
| 51 | + with: |
| 52 | + version: v0.9.1 |
| 53 | + |
| 54 | + - name: Login to Docker Hub |
| 55 | + uses: docker/login-action@v2 |
| 56 | + with: |
| 57 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 58 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 59 | + |
| 60 | + - name: Build and push |
| 61 | + uses: docker/build-push-action@v4 |
| 62 | + with: |
| 63 | + context: . |
| 64 | + file: Dockerfile |
| 65 | + build-args: | |
| 66 | + VERSION=${{needs.get-version.outputs.src_version}} |
| 67 | + OS=${{ matrix.os }} |
| 68 | + ARCH=${{ matrix.arch }} |
| 69 | + platforms: linux/${{ matrix.arch }} |
| 70 | + push: true |
| 71 | + tags: ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-${{ matrix.os }}-${{ matrix.arch }} |
| 72 | + |
| 73 | + publish-manfiest: |
| 74 | + name: Publish Manifest |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: |
| 77 | + - get-version |
| 78 | + - build-images |
| 79 | + if: needs.get-version.outputs.src_version != needs.get-version.outputs.current_version |
| 80 | + steps: |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v3 |
| 83 | + |
| 84 | + - name: Login to Docker Hub |
| 85 | + uses: docker/login-action@v2 |
| 86 | + with: |
| 87 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 88 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 89 | + |
| 90 | + - name: Docker Manifest (latest) |
| 91 | + run: | |
| 92 | + docker manifest create ecmchow/playwright-pnpm:latest \ |
| 93 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-amd64 \ |
| 94 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-arm64 |
| 95 | + |
| 96 | + - name: Docker Annotate (latest) |
| 97 | + run: | |
| 98 | + docker manifest annotate --os linux --arch amd64 \ |
| 99 | + ecmchow/playwright-pnpm:latest ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-amd64 |
| 100 | + |
| 101 | + docker manifest annotate --os linux --arch arm64 \ |
| 102 | + ecmchow/playwright-pnpm:latest ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-arm64 |
| 103 | + |
| 104 | + - name: Docker Push (latest) |
| 105 | + run: | |
| 106 | + docker manifest push ecmchow/playwright-pnpm:latest |
| 107 | +
|
| 108 | + - name: Docker Manifest (latest-jammy) |
| 109 | + run: | |
| 110 | + docker manifest create ecmchow/playwright-pnpm:latest-jammy \ |
| 111 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-amd64 \ |
| 112 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-arm64 |
| 113 | + |
| 114 | + - name: Docker Annotate (latest-jammy) |
| 115 | + run: | |
| 116 | + docker manifest annotate --os linux --arch amd64 \ |
| 117 | + ecmchow/playwright-pnpm:latest-jammy ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-amd64 |
| 118 | + |
| 119 | + docker manifest annotate --os linux --arch arm64 \ |
| 120 | + ecmchow/playwright-pnpm:latest-jammy ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-arm64 |
| 121 | + |
| 122 | + - name: Docker Push (latest-jammy) |
| 123 | + run: | |
| 124 | + docker manifest push ecmchow/playwright-pnpm:latest-jammy |
| 125 | + |
| 126 | + - name: Docker Manifest (latest-focal) |
| 127 | + run: | |
| 128 | + docker manifest create ecmchow/playwright-pnpm:latest-focal \ |
| 129 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-amd64 \ |
| 130 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-arm64 |
| 131 | + |
| 132 | + - name: Docker Annotate (latest-focal) |
| 133 | + run: | |
| 134 | + docker manifest annotate --os linux --arch amd64 \ |
| 135 | + ecmchow/playwright-pnpm:latest-focal ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-amd64 |
| 136 | + |
| 137 | + docker manifest annotate --os linux --arch arm64 \ |
| 138 | + ecmchow/playwright-pnpm:latest-focal ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-arm64 |
| 139 | + |
| 140 | + - name: Docker Push (latest-focal) |
| 141 | + run: | |
| 142 | + docker manifest push ecmchow/playwright-pnpm:latest-focal |
| 143 | +
|
| 144 | + - name: Docker Manifest (jammy) |
| 145 | + run: | |
| 146 | + docker manifest create ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy \ |
| 147 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-amd64 \ |
| 148 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-arm64 |
| 149 | + |
| 150 | + - name: Docker Annotate (jammy) |
| 151 | + run: | |
| 152 | + docker manifest annotate --os linux --arch amd64 \ |
| 153 | + ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-amd64 |
| 154 | + |
| 155 | + docker manifest annotate --os linux --arch arm64 \ |
| 156 | + ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy-arm64 |
| 157 | + |
| 158 | + - name: Docker Push (jammy) |
| 159 | + run: | |
| 160 | + docker manifest push ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-jammy |
| 161 | + |
| 162 | + - name: Docker Manifest (focal) |
| 163 | + run: | |
| 164 | + docker manifest create ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal \ |
| 165 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-amd64 \ |
| 166 | + --amend ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-arm64 |
| 167 | + |
| 168 | + - name: Docker Annotate (focal) |
| 169 | + run: | |
| 170 | + docker manifest annotate --os linux --arch amd64 \ |
| 171 | + ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-amd64 |
| 172 | + |
| 173 | + docker manifest annotate --os linux --arch arm64 \ |
| 174 | + ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal-arm64 |
| 175 | + |
| 176 | + - name: Docker Push (focal) |
| 177 | + run: | |
| 178 | + docker manifest push ecmchow/playwright-pnpm:${{needs.get-version.outputs.src_version}}-focal |
| 179 | +
|
| 180 | + - name: Release |
| 181 | + uses: softprops/action-gh-release@v1 |
| 182 | + with: |
| 183 | + tag_name: ${{needs.get-version.outputs.src_version}} |
0 commit comments