Merge pull request #71 from famedly/chore/update-github-actions-shas #70
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to GitHub Pages | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| artifact_name: | ||
| description: "Name of the uploaded artifacts directory" | ||
| type: string | ||
| required: true | ||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Clean repository | ||
| run: rm -rf ./* | ||
| - name: Download Artifacts | ||
| uses: actions/download-artifact@484a0b528fb4d7bd804637ccb632e47a0e638317 | ||
| with: | ||
| name: ${{inputs.artifact_name}} | ||
| - name: Publish to GitHub Pages | ||
| working-directory: . | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git checkout --orphan gh-pages | ||
| git add . | ||
| git commit -m "Publish to GitHub Pages" | ||
| git push --force origin gh-pages | ||
| - name: Delete Artifact | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 | ||
| env: | ||
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
| with: | ||
| script: | | ||
| const artifacts = await github.rest.actions.listArtifactsForRepo({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| }); | ||
| const artifact = artifacts.data.artifacts.find((artifact) => artifact.name === "${{inputs.artifact_name}}"); | ||
| await github.rest.actions.deleteArtifact({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| artifact_id: ${{artifact.id}}, | ||
| }); | ||