From 16bb8ca2d23e477fdb041b2547fc9427f9bb4f78 Mon Sep 17 00:00:00 2001 From: Hiroyuki Yamada Date: Tue, 3 Oct 2023 16:09:12 +0900 Subject: [PATCH] Add an action to generate a signed timestamp (#1) --- .github/workflows/generate-timestamp.yaml | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/generate-timestamp.yaml diff --git a/.github/workflows/generate-timestamp.yaml b/.github/workflows/generate-timestamp.yaml new file mode 100644 index 0000000..5229b10 --- /dev/null +++ b/.github/workflows/generate-timestamp.yaml @@ -0,0 +1,42 @@ +name: Generate a signed timestamp + +on: + workflow_dispatch: + schedule: + - cron: '0 */6 * * *' + +jobs: + generate-timestamp: + runs-on: ubuntu-latest + + steps: + - name: Checkout scalar-licensing repo + uses: actions/checkout@v3 + with: + repository: scalar-labs/scalar-licensing + token: ${{ secrets.TIMESTAMP_GH_PAT }} + + - name: Setup and execute Gradle 'installDist' task + uses: gradle/gradle-build-action@v2 + with: + arguments: installDist + + - name: Generate a signed timestamp + run: | + echo "${{ secrets.PRIVATE_KEY_PEM }}" > $HOME/private-key.pem + lib/build/install/lib/bin/generate-signed-timestamp --private-key-file=$HOME/private-key.pem > $HOME/timestamp.json + + - name: Checkout this repo + uses: actions/checkout@v3 + with: + token: ${{ secrets.TIMESTAMP_GH_PAT }} + + - name: Commit the timestamp + run: | + cp $HOME/timestamp.json . + git config user.name github-actions + git config user.email action@github.com + git add . + git commit --amend -m "Update the timestamp" + git push -f +