diff --git a/.github/workflows/cd-teardown.yml b/.github/workflows/cd-teardown.yml index 5d989dd6..cdad1b22 100644 --- a/.github/workflows/cd-teardown.yml +++ b/.github/workflows/cd-teardown.yml @@ -6,25 +6,25 @@ env: CI: true jobs: unpublish-npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest if: github.event.ref_type == 'branch' steps: - - name: Prepare for unpublication from npm - uses: actions/setup-node@v2.5.0 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - name: Determine npm tag - # Remove non-alphanumeric characters - # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable - run: echo "TAG_SLUG=$(echo "${{ github.event.ref }}" | tr -cd '[:alnum:]-')" >> $GITHUB_ENV - - name: Remove npm tag for the deleted branch - run: | - export EXISTING_TAGS=$(npm dist-tag ls @inrupt/solid-client | grep --count $TAG_SLUG) - # Unfortunately GitHub Actions does not currently let us do something like - # if: secrets.NPM_TOKEN != '' - # so simply skip the command if the env var is not set: - if [ -n $NODE_AUTH_TOKEN ] && [ $EXISTING_TAGS -eq 1 ]; then npm dist-tag rm @inrupt/solid-client $TAG_SLUG; fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: echo "Package tag [$TAG_SLUG] unpublished." + - name: Prepare for unpublication from npm + uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - name: Determine npm tag + # Remove non-alphanumeric characters + # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + run: echo "TAG_SLUG=$(echo "${{ github.event.ref }}" | tr -cd '[:alnum:]-')" >> $GITHUB_ENV + - name: Remove npm tag for the deleted branch + run: | + export EXISTING_TAGS=$(npm dist-tag ls @inrupt/solid-client | grep --count $TAG_SLUG) + # Unfortunately GitHub Actions does not currently let us do something like + # if: secrets.NPM_TOKEN != '' + # so simply skip the command if the env var is not set: + if [ -n $NODE_AUTH_TOKEN ] && [ $EXISTING_TAGS -eq 1 ]; then npm dist-tag rm @inrupt/solid-client $TAG_SLUG; fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: echo "Package tag [$TAG_SLUG] unpublished." diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e0d6bab5..d1eefd59 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,133 +3,134 @@ name: CD on: push: branches: - - '**' + - "**" tags-ignore: - # Only create preview releases for branches - # (the `release` workflow creates actual releases for version tags): - - '**' + # Only create preview releases for branches + # (the `release` workflow creates actual releases for version tags): + - "**" env: CI: true jobs: prepare-deployment: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest outputs: tag-slug: ${{ steps.determine-npm-tag.outputs.tag-slug }} deployment-id: ${{ fromJson(steps.create-deployment.outputs.data || '{}').id || 'Skipped for Dependabot' }} steps: - - name: Create GitHub Deployment - if: github.actor != 'dependabot[bot]' - id: create-deployment - uses: octokit/request-action@v2.x - with: - route: POST /repos/:repository/deployments - repository: ${{ github.repository }} - ref: ${{ github.sha }} - environment: review - transient_environment: true - auto_merge: false - mediaType: '{"previews": ["flash", "ant-man"]}' - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: - required_contexts: '[]' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Determine npm tag - if: github.actor != 'dependabot[bot]' - id: determine-npm-tag - run: | - # Remove non-alphanumeric characters - # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable - echo "::set-output name=tag-slug::$(echo ${GITHUB_REF#refs/heads/} | tr -cd '[:alnum:]-')" + - name: Create GitHub Deployment + if: github.actor != 'dependabot[bot]' + id: create-deployment + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments + repository: ${{ github.repository }} + ref: ${{ github.sha }} + environment: review + transient_environment: true + auto_merge: false + mediaType: '{"previews": ["flash", "ant-man"]}' + # The deployment runs in parallel with CI, so status checks will never have succeeded yet: + required_contexts: "[]" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Determine npm tag + if: github.actor != 'dependabot[bot]' + id: determine-npm-tag + run: | + # Remove non-alphanumeric characters + # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + echo "::set-output name=tag-slug::$(echo ${GITHUB_REF#refs/heads/} | tr -cd '[:alnum:]-')" publish-npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment] outputs: version-nr: ${{ steps.determine-npm-version.outputs.version-nr }} steps: - - uses: actions/checkout@v2.4.0 - - name: Mark GitHub Deployment as in progress - if: github.actor != 'dependabot[bot]' - id: start-deployment - uses: octokit/request-action@v2.x - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publishing to npm tag [${{ needs.prepare-deployment.outputs.tag-slug }}]…" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - state: in_progress - mediaType: '{"previews": ["flash", "ant-man"]}' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/setup-node@v2.5.0 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - name: Prepare prerelease version - if: github.actor != 'dependabot[bot]' - id: determine-npm-version - run: | - git config user.name $GITHUB_ACTOR - git config user.email gh-actions-${GITHUB_ACTOR}@github.com - # Unfortunately re-running a job does not change its run ID nor run number. - # To prevent re-releasing the same version when re-running the CD job, - # we incorporate a timestamp in the prerelease version: - TIMESTAMP=$(date --utc +%s) - # Make sure the prerelease is tagged with the branch name, and that they are sorted by build: - VERSION_NR=$(npm version prerelease --preid=$TAG_SLUG-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$TIMESTAMP) - echo "::set-output name=version-nr::$VERSION_NR" - env: - TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} - - run: npm ci - - name: Publish an npm tag for this branch - if: github.actor != 'dependabot[bot]' - run: | - # Unfortunately GitHub Actions does not currently let us do something like - # if: secrets.NPM_TOKEN != '' - # so simply skip the command if the env var is not set: - if [ -z $NODE_AUTH_TOKEN ]; then echo "No npm token defined; package not published."; fi - if [ -n $NODE_AUTH_TOKEN ]; then npm publish --access public --tag "$TAG_SLUG"; fi - if [ -n $NODE_AUTH_TOKEN ]; then echo "Package published. To install, run:"; fi - if [ -n $NODE_AUTH_TOKEN ]; then echo ""; fi - if [ -n $NODE_AUTH_TOKEN ]; then echo " npm install @inrupt/solid-ui-react@$TAG_SLUG"; fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} - - name: Mark GitHub Deployment as successful - if: github.actor != 'dependabot[bot]' - uses: octokit/request-action@v2.x - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - environment_url: 'https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${{ needs.prepare-deployment.outputs.tag-slug }}' - description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${{ needs.prepare-deployment.outputs.tag-slug }}" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: success - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Mark GitHub Deployment as failed - uses: octokit/request-action@v2.x - if: failure() && github.actor != 'dependabot[bot]' - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publication to npm failed. Review the GitHub Actions log for more information." - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: failure - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Waiting for npm CDNs to update... - if: github.actor != 'dependabot[bot]' - run: | - echo "Giving npm some time to make the newly-published package available…" - sleep 5m - echo "Done — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." + - uses: actions/checkout@v3 + - name: Mark GitHub Deployment as in progress + if: github.actor != 'dependabot[bot]' + id: start-deployment + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publishing to npm tag [${{ needs.prepare-deployment.outputs.tag-slug }}]…" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + state: in_progress + mediaType: '{"previews": ["flash", "ant-man"]}' + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + cache: npm + - name: Prepare prerelease version + if: github.actor != 'dependabot[bot]' + id: determine-npm-version + run: | + git config user.name $GITHUB_ACTOR + git config user.email gh-actions-${GITHUB_ACTOR}@github.com + # Unfortunately re-running a job does not change its run ID nor run number. + # To prevent re-releasing the same version when re-running the CD job, + # we incorporate a timestamp in the prerelease version: + TIMESTAMP=$(date --utc +%s) + # Make sure the prerelease is tagged with the branch name, and that they are sorted by build: + VERSION_NR=$(npm version prerelease --preid=$TAG_SLUG-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$TIMESTAMP) + echo "::set-output name=version-nr::$VERSION_NR" + env: + TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} + - run: npm ci + - name: Publish an npm tag for this branch + if: github.actor != 'dependabot[bot]' + run: | + # Unfortunately GitHub Actions does not currently let us do something like + # if: secrets.NPM_TOKEN != '' + # so simply skip the command if the env var is not set: + if [ -z $NODE_AUTH_TOKEN ]; then echo "No npm token defined; package not published."; fi + if [ -n $NODE_AUTH_TOKEN ]; then npm publish --access public --tag "$TAG_SLUG"; fi + if [ -n $NODE_AUTH_TOKEN ]; then echo "Package published. To install, run:"; fi + if [ -n $NODE_AUTH_TOKEN ]; then echo ""; fi + if [ -n $NODE_AUTH_TOKEN ]; then echo " npm install @inrupt/solid-ui-react@$TAG_SLUG"; fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} + - name: Mark GitHub Deployment as successful + if: github.actor != 'dependabot[bot]' + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + environment_url: "https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${{ needs.prepare-deployment.outputs.tag-slug }}" + description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${{ needs.prepare-deployment.outputs.tag-slug }}" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: success + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Mark GitHub Deployment as failed + uses: octokit/request-action@v2.x + if: failure() && github.actor != 'dependabot[bot]' + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publication to npm failed. Review the GitHub Actions log for more information." + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: failure + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Waiting for npm CDNs to update... + if: github.actor != 'dependabot[bot]' + run: | + echo "Giving npm some time to make the newly-published package available…" + sleep 5m + echo "Done — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3be26d19..03b2f51d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,38 +6,46 @@ env: CI: true jobs: build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - run: npm ci + - run: npm run audit --production + - run: npm run audit-licenses + - run: npm run build + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist + test: + needs: build runs-on: ${{ matrix.os }} strategy: matrix: # Available OS's: https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners - os: [ubuntu-20.04, windows-2019] - node-version: [16.x, 14.x, 12.x] + os: [ubuntu-latest, windows-latest] + node-version: [16.x, 14.x] steps: - - uses: actions/checkout@v2.4.0 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2.5.0 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Cache node modules - uses: actions/cache@v2.1.7 - env: - cache-name: cache-node-modules - with: - path: node_modules - key: ${{ runner.os }}-node${{ runner.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + cache: npm - run: npm ci + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: dist + path: dist - run: npm run lint - run: npm run test - - run: npm run audit --production - - run: npm run audit-licenses - - run: npm run build - name: Archive code coverage results - uses: actions/upload-artifact@v2.3.0 + uses: actions/upload-artifact@v3 with: name: code-coverage-report path: coverage - - name: Archive production artifacts - uses: actions/upload-artifact@v2.3.0 - with: - name: dist - path: dist diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 330e37b1..4e44e641 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -8,12 +8,12 @@ name: "Static Application security Testing (CodeQL)" on: push: - branches: [ '*' ] + branches: ["*"] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - - cron: '0 12 * * 6' + - cron: "0 12 * * 6" jobs: analyze: @@ -27,40 +27,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ["javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v2.4.0 + - name: Checkout repository + uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d9e44bf..38b57bb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,97 +1,98 @@ name: Release -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+ +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ env: CI: true jobs: prepare-deployment: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest outputs: deployment-id: ${{ fromJson(steps.create-deployment.outputs.data).id }} steps: - - name: Create GitHub Deployment - id: create-deployment - uses: octokit/request-action@v2.x - with: - route: POST /repos/:repository/deployments - repository: ${{ github.repository }} - ref: ${{ github.sha }} - environment: review - transient_environment: true - auto_merge: false - mediaType: '{"previews": ["flash", "ant-man"]}' - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: - required_contexts: '[]' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Create GitHub Deployment + id: create-deployment + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments + repository: ${{ github.repository }} + ref: ${{ github.sha }} + environment: review + transient_environment: true + auto_merge: false + mediaType: '{"previews": ["flash", "ant-man"]}' + # The deployment runs in parallel with CI, so status checks will never have succeeded yet: + required_contexts: "[]" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" publish-npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment] steps: - - uses: actions/checkout@v2.4.0 - - name: Mark GitHub Deployment as in progress - id: start-deployment - uses: octokit/request-action@v2.x - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publishing to npm tag [${GITHUB_REF#refs/tags/v}]…" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - state: in_progress - mediaType: '{"previews": ["flash", "ant-man"]}' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Prepare for publication to npm - uses: actions/setup-node@v2.5.0 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - name: Publish to npm - run: | - npm publish --access public - echo "Package published. To install, run:" - echo "" - echo " npm install @inrupt/solid-ui-react" - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Mark GitHub Deployment as successful - uses: octokit/request-action@v2.x - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - environment_url: 'https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${GITHUB_REF#refs/tags/v}' - description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${GITHUB_REF#refs/tags/v}" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: success - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Mark GitHub Deployment as failed - uses: octokit/request-action@v2.x - if: failure() - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publication to npm failed. Review the GitHub Actions log for more information." - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: failure - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Waiting for npm CDNs to update... - run: | - echo "Giving npm some time to make the newly-published package available…" - sleep 5m - echo "Done waiting — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." + - uses: actions/checkout@v3 + - name: Mark GitHub Deployment as in progress + id: start-deployment + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publishing to npm tag [${GITHUB_REF#refs/tags/v}]…" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + state: in_progress + mediaType: '{"previews": ["flash", "ant-man"]}' + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Prepare for publication to npm + uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + cache: npm + - run: npm ci + - name: Publish to npm + run: | + npm publish --access public + echo "Package published. To install, run:" + echo "" + echo " npm install @inrupt/solid-ui-react" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Mark GitHub Deployment as successful + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + environment_url: "https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${GITHUB_REF#refs/tags/v}" + description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${GITHUB_REF#refs/tags/v}" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: success + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Mark GitHub Deployment as failed + uses: octokit/request-action@v2.x + if: failure() + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publication to npm failed. Review the GitHub Actions log for more information." + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: failure + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Waiting for npm CDNs to update... + run: | + echo "Giving npm some time to make the newly-published package available…" + sleep 5m + echo "Done waiting — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK."