Skip to content

Commit

Permalink
test: try running job in a new container
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwayakchih authored Jan 16, 2025
1 parent bcca140 commit 3035a5e
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions .github/workflows/puppeteer-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,39 @@ on:
branches: [ "puppeteer-container" ]
tags: [ v* ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: puppeteer

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
name: ${{ steps.step1.outputs.name }}
version: ${{ steps.step1.outputs.version }}
steps:
- id: step1
run: |
IMAGE_ID=${{ env.REGISTRY }}/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo "name=$IMAGE_ID" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs: prepare

permissions:
contents: read
packages: write
attestations: write
id-token: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: puppeteer

steps:
- name: Workaround Windows mess and set git to keep original line endings
run: git config --global core.autocrlf false
Expand Down Expand Up @@ -48,12 +66,17 @@ jobs:
- name: Push container image
if: success()
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
podman tag $IMAGE_NAME $IMAGE_ID:$VERSION
podman push $IMAGE_ID:$VERSION
IMAGE=${{ needs.prepare.outputs.name }}:${{ needs.prepare.outputs.version }}
podman tag $IMAGE_NAME $IMAGE
podman push $IMAGE
test:
runs-on: ubuntu-latest
needs: prepare
container: ${{ env.REGISTRY }}/${{ needs.prepare.outputs.name }}:${{ needs.prepare.outputs.version }}
steps:
- name: Self test
run: |
echo "Chrome: " $CHROME_BIN
pwd
ls -la

0 comments on commit 3035a5e

Please sign in to comment.