fix(ci): markdown png not updated
This commit is contained in:
39
.github/scripts/files/examples.yml
vendored
39
.github/scripts/files/examples.yml
vendored
@@ -39,6 +39,11 @@ jobs:
|
||||
|
||||
<%- steps.split("\n").map(line => ` ${line}`).join("\n") %>
|
||||
|
||||
- name: Screenshot markdown example
|
||||
if: ${{ success() || failure() }}
|
||||
run: |
|
||||
node /metrics/.github/scripts/markdown_example.mjs
|
||||
mv metrics.markdown.png /
|
||||
- name: Publish examples
|
||||
if: ${{ success() || failure() }}
|
||||
run: |
|
||||
@@ -46,42 +51,11 @@ jobs:
|
||||
sudo mv /metrics_renders/* ./
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||
git pull
|
||||
git add --all
|
||||
git commit -m "chore: update examples"
|
||||
git push
|
||||
|
||||
# ======================================================================================
|
||||
# Markdown as png (for readme updates)
|
||||
# ======================================================================================
|
||||
|
||||
examples-markdown:
|
||||
runs-on: ubuntu-latest
|
||||
if: "github.repository == 'lowlighter/metrics'"
|
||||
container: ghcr.io/lowlighter/metrics:master
|
||||
needs: [examples]
|
||||
steps:
|
||||
- name: Screenshot markdown example
|
||||
run: |
|
||||
node /metrics/.github/scripts/markdown_example.mjs
|
||||
echo "METRICS_MARKDOWN_EXAMPLE=$(base64 --wrap=0 metrics.markdown.png)" >> $GITHUB_ENV
|
||||
- name: Update markdown example
|
||||
uses: actions/github-script@v5
|
||||
env:
|
||||
METRICS_MARKDOWN_EXAMPLE: "${{ env.METRICS_MARKDOWN_EXAMPLE }}"
|
||||
with:
|
||||
script: |
|
||||
try {
|
||||
const {data:{sha}} = await github.rest.repos.getContent({...context.repo, path:"metrics.markdown.png"})
|
||||
console.log(`current sha: ${sha}`)
|
||||
github.rest.repos.createOrUpdateFileContents({
|
||||
...context.repo,
|
||||
path:"metrics.markdown.png",
|
||||
message:`Auto-generated metrics for run #${github.context ? github.context.runId : "0000000000"}`,
|
||||
content:process.env.METRICS_MARKDOWN_EXAMPLE,
|
||||
sha,
|
||||
})
|
||||
} catch (error) { console.log(error) }
|
||||
|
||||
# ======================================================================================
|
||||
# Special job used to render lowlighter/metrics repository assets
|
||||
# ======================================================================================
|
||||
@@ -153,6 +127,7 @@ jobs:
|
||||
sudo mv /metrics_renders/* ./
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||
git pull
|
||||
git add --all
|
||||
git commit -m "chore: update examples"
|
||||
git push
|
||||
|
||||
Reference in New Issue
Block a user