X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=.github%2Fworkflows%2Fsync_site.yml;h=772675b8d5e6bd33badca9cd38334a4beab0f7f2;hb=ed5863eb460c94a0309362c325db9a5f1ccfd8ed;hp=d2eae51b30dee19ead6e03cf109218f3a452bc9e;hpb=ac13fd504e5b117843294003c2cad0645959617c;p=m6w6%2Fm6w6.github.io diff --git a/.github/workflows/sync_site.yml b/.github/workflows/sync_site.yml index d2eae51..772675b 100644 --- a/.github/workflows/sync_site.yml +++ b/.github/workflows/sync_site.yml @@ -6,31 +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: + - run: umask 0077 && echo "${{ env.SYNC_SECRET }}" >/tmp/sync_secret - uses: actions/github-script@v5 - id: shitshow with: - result-encoding: string script: | - console.log(context); const artifact_id = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, - run_id: context.payload.event.workflow.run_id, + run_id: context.payload.workflow_run.id, per_page: 1, }); - console.log(artifact_id); - const artifact_url = await github.rest.actions.downloadArtifact({ + 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", }); - console.log(artifact_url); - return artifact_url.headers["location"]; - - run: curl -sSLO ${{ steps.shitshow.outputs.result }} - - run: ls -al + await exec.exec(process.env.SYNC_COMMAND, [], { + input: Buffer.from(artifact.data) + });