Skip to content

Commit

Permalink
Merge branch 'dev' into artifact-test
Browse files Browse the repository at this point in the history
  • Loading branch information
recrwplay authored Jan 18, 2024
2 parents f2e8dc7 + 3528ca8 commit 5f0846c
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/docs-deploy-surge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ jobs:

runs-on: ubuntu-latest

# with download-artifact v4 we need to use a matrix to get HTML and changelog artifacts
# because the artifacts will have been uploaded separately to ensure unique names
strategy:
matrix:
required-artifacts: ["docs", "changelog"]

steps:
- name: "Download built documentation"
uses: actions/[email protected]
Expand All @@ -42,23 +36,30 @@ jobs:
repo: context.repo.repo,
run_id: ${{ env.RUN_ID }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "${{ matrix.required-artifacts }}"
})[0];
if (matchArtifact != undefined) {
var downloadList = ["docs", "changelog"];
downloadList.forEach((artifact) => {
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == artifact;
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{ env.WORKSPACE }}/${{ matrix.required-artifacts }}.zip', Buffer.from(download.data));
}
const fileName = ${{ env.WORKSPACE }} + '/' + artifact + '.zip';
fs.writeFileSync(fileName, Buffer.from(download.data));
});
- id: unzip docs
run: unzip docs.zip

- id: unzip
if: ${{ hashFiles(matrix.required-artifacts) != '' }}
run: unzip ${{ matrix.required-artifacts }}.zip
- id: unzip changelog
if: ${{ hashFiles('changelog') != '' }}
run: unzip changelog.zip

- id: get-deploy-id
run: |
Expand Down

0 comments on commit 5f0846c

Please sign in to comment.