X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fm6w6.github.io;a=blobdiff_plain;f=.github%2Fworkflows%2Fsync_site.yml;h=772675b8d5e6bd33badca9cd38334a4beab0f7f2;hp=19722ea315574e83b20a0f38bd4e94ce4b4a6789;hb=ed5863eb460c94a0309362c325db9a5f1ccfd8ed;hpb=61f80f3aa8286c47dd2e8879bc2e1a8fb2d326ef diff --git a/.github/workflows/sync_site.yml b/.github/workflows/sync_site.yml index 19722ea..772675b 100644 --- a/.github/workflows/sync_site.yml +++ b/.github/workflows/sync_site.yml @@ -6,14 +6,31 @@ on: workflows: [pages-build-deployment] types: [completed] +env: + SYNC_SECRET: ${{ secrets.SYNC_SECRET }} + SYNC_COMMAND: ${{ secrets.SYNC_COMMAND }} + jobs: sync: runs-on: ubuntu-latest steps: - - uses: dawidd6/action-download-artifact@v2 + - run: umask 0077 && echo "${{ env.SYNC_SECRET }}" >/tmp/sync_secret + - uses: actions/github-script@v5 with: - workflow: pages-build-deployment - workflow_conclusion: success - name: github-pages - - run: tar tf artifact.tar + script: | + const artifact_id = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + per_page: 1, + }); + const artifact = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: artifact_id.data.artifacts[0].id, + archive_format: "zip", + }); + await exec.exec(process.env.SYNC_COMMAND, [], { + input: Buffer.from(artifact.data) + });