X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=.github%2Fworkflows%2Fsync_site.yml;h=5afa9eb5210c0676caeb95380ae15c96a2f055c6;hb=53d9b3f7587e5cdb8ac5845ae979347aaedbf889;hp=8c362d9ba46e1cc7d02a58e30c9eea21fc3a7031;hpb=5798c2c1650ccbbc00489ccb73aa6cbd57eb9c91;p=m6w6%2Fm6w6.github.io diff --git a/.github/workflows/sync_site.yml b/.github/workflows/sync_site.yml index 8c362d9..5afa9eb 100644 --- a/.github/workflows/sync_site.yml +++ b/.github/workflows/sync_site.yml @@ -1,17 +1,31 @@ - name: sync_site - on: workflow_run: 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: actions/download-artifact@v2 + - run: umask 0077 && echo "${{ env.SYNC_SECRET }}" >/tmp/sync_secret + - uses: actions/github-script@v5 with: - 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) + });