chore: Update versions and add build test script #4
Workflow file for this run
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: Test Package External | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
verify-access: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "check PUBLISH_GITHUB_TOKEN exists" | |
env: | |
super_secret: ${{ secrets.PUBLISH_GITHUB_TOKEN }} | |
if: ${{ env.super_secret == '' }} | |
run: 'echo "echo the secret \"PUBLISH_GITHUB_TOKEN\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it"' | |
build-tar: | |
runs-on: ubuntu-latest | |
needs: verify-access | |
outputs: | |
tar_name: ${{ steps.export_name.outputs.tar_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- run: npm ci | |
- run: npm run build | |
- id: export_name | |
run: echo "tar_name=$(npm pack)" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.export_name.outputs.tar_name }} | |
path: ${{ github.workspace }} | |
test-externally: | |
runs-on: ubuntu-latest | |
needs: build-tar | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: ${{ needs.build-tar.outputs.tar_name }} | |
path: ${{ github.workspace }} | |
- uses: actions/checkout@v4 | |
with: | |
repository: EmandM/import-test | |
ref: master | |
- uses: actions/setup-node@v4 | |
- run: npm ci | |
- run: npm uninstall ts-mock-imports # Ensure it is a clean install of the test package | |
- env: | |
TAR_PATH: ${{ needs.build-tar.outputs.tar_name }} | |
run: npm install ./$TAR_PATH | |
- run: npm test |