Skip to content

assets-generator

assets-generator #5462

Workflow file for this run

name: assets-generator
on:
schedule:
- cron: "37 */2 * * *" # this is UTC
push:
branches:
- "main"
paths:
- "src/**"
- "go.mod"
- "go.sum"
workflow_dispatch:
jobs:
assets-generator:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.add-and-commit.outputs.committed }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Connect to Tailnet
uses: tailscale/github-action@v2
with:
args: --accept-dns=true
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:github-runner
- name: Run go code
run: |
go run ./src -sleep .
- name: JQ formatting JSON
run: |
# running jq -c . to compact output
jq -c . output.json > docs/data.min.json
# running jq . to easier readable file
jq . output.json > docs/data.json
- name: Generate checksum for data.json
run: |
# generating checksum for all JSON files in folder
find *.json -type f -exec sha256sum {} \; > sha256sum.txt
find *.json -type f -exec sha512sum {} \; > sha512sum.txt
working-directory: docs
- uses: EndBug/add-and-commit@v9
id: add-and-commit
with:
add: "docs"
message: ".github/workflows/generate.yml: workflow generated JSON"
github-pages-deploy:
runs-on: ubuntu-latest
needs: assets-generator
if: needs.assets-generator.outputs.changed == 'true'
steps:
- name: Dispatch GitHub Pages deployment
uses: peter-evans/repository-dispatch@v3
with:
event-type: github-pages