Artefacts #5
This file contains 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: Artefacts | |
on: workflow_dispatch | |
jobs: | |
build-job: | |
runs-on: ubuntu-latest | |
outputs: | |
# GitHub action output - set var | |
script-file: "${{ steps.publish_step_id.outputs.script-file-var }}" | |
steps: | |
- name: Get Code | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm test | |
- name: Build website | |
run: npm run build | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-files | |
path: | | |
dist | |
package.json | |
# GitHub action output - set var | |
- name: Publish JS filename | |
id: publish_step_id | |
run: find dist/assets/*.js -type f -execdir echo 'script-file-var={}' >> $GITHUB_OUTPUT ';' | |
deploy-job: | |
needs: build-job | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-files | |
- name: Output contents | |
run: ls | |
- name: Output filename | |
run: echo "${{ needs.build-job.outputs.script-file }}" |