Add GitHub workflow to record screenshots when manually triggered.
This commit is contained in:
35
.github/workflows/recordScreenshots.yml
vendored
Normal file
35
.github/workflows/recordScreenshots.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Record screenshots
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
param_branch:
|
||||
description: 'Branch to record the screenshots on'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
# Enrich gradle.properties for CI/CD
|
||||
env:
|
||||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
||||
|
||||
jobs:
|
||||
record:
|
||||
name: Record screenshots on branch ${{ inputs.param_branch }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout with LFS
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: 'true'
|
||||
- name: ☕️ Use JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Record screenshots
|
||||
run: "./.github/workflows/scripts/recordScreenshots.sh"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
|
||||
BRANCH: ${{ inputs.param_branch }}
|
||||
43
.github/workflows/scripts/recordScreenshots.sh
vendored
Executable file
43
.github/workflows/scripts/recordScreenshots.sh
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2023 New Vector Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
if [[ -z ${GITHUB_TOKEN} ]]; then
|
||||
echo "Missing GITHUB_TOKEN variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${GITHUB_REPOSITORY} ]]; then
|
||||
echo "Missing GITHUB_REPOSITORY variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${BRANCH} ]]; then
|
||||
echo "Missing BRANCH variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./gradlew recordPaparazziDebug --stacktrace -PpreDexEnable=false --max-workers 4 --warn
|
||||
|
||||
git config user.name "ElementBot"
|
||||
git config user.email "benoitm+elementbot@element.io"
|
||||
git fetch --all
|
||||
git checkout --track "origin/$BRANCH"
|
||||
git add -A
|
||||
git commit -m "Update screenshots"
|
||||
git push "https://$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
|
||||
echo "Done!"
|
||||
Reference in New Issue
Block a user