Skip to content

Commit

Permalink
chore: auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Sep 15, 2023
1 parent ac64fa2 commit c9e70f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 76 deletions.
91 changes: 16 additions & 75 deletions .github/workflows/release.yml
Expand Up @@ -258,7 +258,7 @@ jobs:
RELEASE_COMMENT_ID: ${{ needs.release.outputs.comment-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm exec --offline -- template-oss-release-manager --lockfile=false --publish=false
npm exec --offline -- template-oss-release-manager --lockfile=false --publish=true
npm run rp-pull-request --ignore-scripts --if-present
- name: Commit
id: commit
Expand Down Expand Up @@ -407,85 +407,26 @@ jobs:
defaults:
run:
shell: bash
permissions:
deployments: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ fromJSON(needs.release.outputs.release).tagName }}
- name: Setup Node
uses: actions/setup-node@v3
id: node
with:
node-version: 20.x
check-latest: contains('20.x', '.x')

# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
- name: Update Windows npm
if: |
matrix.platform.os == 'windows-latest' && (
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
)
node-version: 18.x
- name: Install npm@latest
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
# Start on Node 10 because we dont test on anything lower
- name: Install npm@7 on Node 10
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"
- name: Install npm@8 on Node 12
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v12.')
id: npm-8
run: |
npm i --prefer-online --no-fund --no-audit -g npm@8
echo "updated=true" >> "$GITHUB_OUTPUT"
- name: Install npm@9 on Node 14/16/18.0
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
id: npm-9
run: |
npm i --prefer-online --no-fund --no-audit -g npm@9
echo "updated=true" >> "$GITHUB_OUTPUT"
- name: Install npm@latest on Node
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest

- name: npm Version
run: npm -v
- name: View in Registry
run: |
EXIT_CODE=0
function is_published {
if npm view "$@" --loglevel=error > /dev/null; then
echo 0
else
echo 1
fi
}
for release in $(echo '${{ needs.release.outputs.releases }}' | jq -r '.[] | @base64'); do
name=$(echo "$release" | base64 --decode | jq -r .pkgName)
version=$(echo "$release" | base64 --decode | jq -r .version)
spec="$name@$version"
status=$(is_published "$spec")
if [[ "$status" -eq 1 ]]; then
echo "$spec ERROR"
EXIT_CODE=$status
else
echo "$spec OK"
fi
done
exit $EXIT_CODE
npm i --prefer-online --no-fund --no-audit -g npm@latest
npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN}
- name: Publish
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: npm publish --provenance --tag=next-5

post-release-integration:
needs: [ release, release-integration ]
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -55,6 +55,7 @@
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.19.0",
"backport": 5
"backport": 5,
"publish": true
}
}

0 comments on commit c9e70f3

Please sign in to comment.