From 25d40986fb35d3e38bc7378cb4f50aec2b804a06 Mon Sep 17 00:00:00 2001 From: Yayo Date: Sat, 19 Aug 2023 12:22:19 +0200 Subject: [PATCH] Update screenshot-testing.yml --- .github/workflows/screenshot-testing.yml | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/screenshot-testing.yml b/.github/workflows/screenshot-testing.yml index 20f67573b8..78ce5ef269 100644 --- a/.github/workflows/screenshot-testing.yml +++ b/.github/workflows/screenshot-testing.yml @@ -20,7 +20,7 @@ env: FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN}} jobs: - generate-screenshots: + generate-screenshots-master: name: Acceptance tests runs-on: ubuntu-latest steps: @@ -37,9 +37,7 @@ jobs: - name: Instalar Homebrew run: | - sudo apt-get update -y - sudo apt-get install -y librsvg2-2 - sudo apt-get install librsvg2-bin + sudo apt-get install -y librsvg2-bin /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - name: Update master to last version @@ -58,10 +56,28 @@ jobs: git commit -m "Screenshot tests from master" git push origin acceptance-tests - - name: Screenshot testing! + generate-screenshots: + name: Acceptance tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Checkout branch or create new one + run: | + git fetch + if git branch -a | grep origin/${{ github.event.inputs.fileID }}; then + git checkout ${{ github.event.inputs.fileID }} + else + git checkout -b ${{ github.event.inputs.fileID }} + fi + + - name: Instalar Homebrew run: | - export FIGMA_TOKEN=figd_6Zp3HkWokqz7z7sFS5h4WPn6PSVkdbkhMNr5iaS- - npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components ${{ github.event.inputs.fileID }} -O @figma-export/output-components-as-svg + sudo apt-get install -y librsvg2-bin + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + - name: Export new screenshots + run: npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components ${{ github.event.inputs.fileID }} -O @figma-export/output-components-as-svg - name: convert-svg2png run: | @@ -73,7 +89,7 @@ jobs: git config user.name "github-actions" git config user.email "github-actions[bot]@users.noreply.github.com" git add . - git commit -m "Screenshot tests" + git commit -m "Screenshot tests from ${{ github.event.inputs.fileID }}" git push origin ${{ github.event.inputs.fileID }} # - name: Create Pull-Request