|
8 | 8 | env: |
9 | 9 | CI: true |
10 | 10 | jobs: |
11 | | - prepare-deployment: |
12 | | - runs-on: ubuntu-latest |
13 | | - outputs: |
14 | | - deployment-id: ${{ fromJson(steps.create-deployment.outputs.data).id }} |
15 | | - steps: |
16 | | - - name: Create GitHub Deployment |
17 | | - id: create-deployment |
18 | | - |
19 | | - with: |
20 | | - route: POST /repos/:repository/deployments |
21 | | - repository: ${{ github.repository }} |
22 | | - ref: ${{ github.sha }} |
23 | | - environment: review |
24 | | - transient_environment: true |
25 | | - auto_merge: false |
26 | | - mediaType: '{"previews": ["flash", "ant-man"]}' |
27 | | - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: |
28 | | - required_contexts: "[]" |
29 | | - env: |
30 | | - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
31 | | - |
32 | 11 | publish-npm: |
33 | 12 | runs-on: ubuntu-latest |
34 | | - needs: [prepare-deployment] |
35 | 13 | steps: |
36 | 14 | - uses: actions/checkout@v3 |
37 | | - - name: Mark GitHub Deployment as in progress |
38 | | - id: start-deployment |
39 | | - |
40 | | - with: |
41 | | - route: POST /repos/:repository/deployments/:deployment/statuses |
42 | | - repository: ${{ github.repository }} |
43 | | - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} |
44 | | - environment: review |
45 | | - description: "Publishing to npm tag [${GITHUB_REF#refs/tags/v}]…" |
46 | | - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
47 | | - state: in_progress |
48 | | - mediaType: '{"previews": ["flash", "ant-man"]}' |
49 | | - env: |
50 | | - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
51 | 15 | - name: Prepare for publication to npm |
52 | 16 | uses: actions/setup-node@v3 |
53 | 17 | with: |
54 | 18 | node-version: "16.x" |
55 | 19 | registry-url: "https://registry.npmjs.org" |
56 | 20 | cache: npm |
57 | 21 | - run: npm ci |
58 | | - - name: Publish to npm |
59 | | - run: | |
60 | | - npm publish --access public |
61 | | - echo "Package published. To install, run:" |
62 | | - echo "" |
63 | | - echo " npm install @inrupt/solid-ui-react" |
| 22 | + - run: npm publish --access public |
64 | 23 | env: |
65 | 24 | NODE_AUTH_TOKEN: ${{ secrets.INRUPT_NPM_TOKEN }} |
66 | | - - name: Mark GitHub Deployment as successful |
67 | | - |
68 | | - with: |
69 | | - route: POST /repos/:repository/deployments/:deployment/statuses |
70 | | - repository: ${{ github.repository }} |
71 | | - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} |
72 | | - environment: review |
73 | | - environment_url: "https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${GITHUB_REF#refs/tags/v}" |
74 | | - description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${GITHUB_REF#refs/tags/v}" |
75 | | - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
76 | | - mediaType: '{"previews": ["flash", "ant-man"]}' |
77 | | - state: success |
78 | | - env: |
79 | | - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
80 | | - - name: Mark GitHub Deployment as failed |
81 | | - |
82 | | - if: failure() |
83 | | - with: |
84 | | - route: POST /repos/:repository/deployments/:deployment/statuses |
85 | | - repository: ${{ github.repository }} |
86 | | - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} |
87 | | - environment: review |
88 | | - description: "Publication to npm failed. Review the GitHub Actions log for more information." |
89 | | - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
90 | | - mediaType: '{"previews": ["flash", "ant-man"]}' |
91 | | - state: failure |
92 | | - env: |
93 | | - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
94 | | - - name: Waiting for npm CDNs to update... |
95 | | - run: | |
96 | | - echo "Giving npm some time to make the newly-published package available…" |
97 | | - sleep 5m |
98 | | - 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." |
0 commit comments