Skip to content

Commit f6109fc

Browse files
committed
test release changes
1 parent 2165e4f commit f6109fc

File tree

1 file changed

+108
-82
lines changed

1 file changed

+108
-82
lines changed

.github/workflows/release.yml

Lines changed: 108 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -52,89 +52,115 @@ jobs:
5252
uses: actions/setup-node@v4
5353
with:
5454
node-version: 20.x
55-
- name: Build Node.js package
55+
- name: Builder browser package
5656
run: |
5757
npm install
58-
node ./tools/build.js -t node
59-
npm test
60-
61-
- name: Publish highlight.js to NPM
62-
id: publish
63-
uses: JS-DevTools/npm-publish@v3
64-
with:
65-
check-version: true
66-
token: ${{ secrets.NPM_TOKEN }}
67-
package: ./build/package.json
68-
tag: ${{ env.NPM_TAG }}
69-
70-
- if: steps.publish.outputs.type != 'none'
71-
run: |
72-
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
73-
74-
# if stable release
75-
- name: Stable Release
76-
if: env.RELEASING == 'stable'
77-
run: echo "BRANCH_NAME=${MAJOR_VERSION}-stable" >> $GITHUB_ENV
78-
# else (beta)
79-
- name: Beta Release
80-
if: env.RELEASING == 'beta'
81-
run: echo "BRANCH_NAME=main" >> $GITHUB_ENV
82-
- name: Confirm release is either stable or beta
83-
if: ${{ !(env.RELEASING == 'stable' || env.RELEASING == 'beta') }}
84-
run: |
85-
echo We seem to be releasing `${RELEASING}`.
86-
false
87-
88-
- name: Checkout cdn-release
89-
uses: actions/checkout@v4
58+
node ./tools/build.js -t browser :common
59+
# npm run test-browser
60+
- name: Create Release
61+
id: create_release
62+
uses: actions/create-release@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9065
with:
91-
repository: 'highlightjs/cdn-release'
92-
path: 'cdn-release'
93-
token: ${{ secrets.CDN_REPO_TOKEN }}
94-
ref: ${{ env.BRANCH_NAME }}
95-
96-
- name: Build CDN package
97-
run: node ./tools/build.js -t cdn :common
98-
99-
- name: Commmit & Push cdn-release ${{ env.TAG_NAME }}
100-
working-directory: ./cdn-release
101-
run: |
102-
rm -r ./build
103-
mv ../build/ ./build/
104-
mv ./build/DIGESTS.md .
105-
git config user.name github-actions
106-
git config user.email [email protected]
107-
git add ./build/
108-
git add ./DIGESTS.md
109-
git commit -m'Update to version ${{ env.TAG_NAME }}'
110-
git tag ${TAG_NAME}
111-
git push -f --atomic origin ${BRANCH_NAME} ${TAG_NAME}
112-
113-
- name: Publish cdn-assets to NPM
114-
id: publish_cdn
115-
uses: JS-DevTools/npm-publish@v3
66+
tag_name: ${{ github.ref }}
67+
release_name: Release ${{ github.ref }}
68+
draft: true
69+
# todo: determine this auto-magically
70+
prerelease: ${{ !(env.RELEASING == 'stable') }}
71+
- name: Upload Release Asset
72+
id: upload-release-asset
73+
uses: actions/upload-release-asset@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11676
with:
117-
check-version: true
118-
token: ${{ secrets.NPM_TOKEN }}
119-
package: ./cdn-release/build/package.json
120-
tag: ${{ env.NPM_TAG }}
121-
122-
# log.info('Updating CDN repo at %s' % settings.HLJS_CDN_SOURCE)
123-
# run(['nodejs', 'tools/build.js', '--target', 'cdn', ':common'])
124-
# os.chdir(settings.HLJS_CDN_SOURCE)
125-
# run(['git', 'pull', '-f'])
126-
# lines = run(['git', '--git-dir', os.path.join(settings.HLJS_CDN_SOURCE, '.git'), 'tag'])
127-
# build_dir = os.path.join(settings.HLJS_CDN_SOURCE, 'build')
128-
# if version in lines:
129-
# log.info('Tag %s already exists in the local CDN repo' % version)
130-
# else:
131-
# if os.path.exists(build_dir):
132-
# shutil.rmtree(build_dir)
133-
# shutil.move(os.path.join(settings.HLJS_SOURCE, 'build'), build_dir)
134-
# run(['git', 'add', '.'])
135-
# run(['git', 'commit', '-m', 'Update to version %s' % version])
136-
# run(['git', 'tag', version])
137-
# run(['git', 'push'])
138-
# run(['git', 'push', '--tags'])
139-
# npm_publish(build_dir)
140-
# os.chdir(settings.HLJS_SOURCE)
77+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
78+
asset_path: ./build/highlight.js
79+
asset_name: highlight.js
80+
asset_content_type: text/javascript
81+
# - name: Build Node.js package
82+
# run: |
83+
# npm install
84+
# node ./tools/build.js -t node
85+
# npm test
86+
87+
# - name: Publish highlight.js to NPM
88+
# id: publish
89+
# uses: JS-DevTools/npm-publish@v3
90+
# with:
91+
# check-version: true
92+
# token: ${{ secrets.NPM_TOKEN }}
93+
# package: ./build/package.json
94+
# tag: ${{ env.NPM_TAG }}
95+
96+
# - if: steps.publish.outputs.type != 'none'
97+
# run: |
98+
# echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
99+
100+
# # if stable release
101+
# - name: Stable Release
102+
# if: env.RELEASING == 'stable'
103+
# run: echo "BRANCH_NAME=${MAJOR_VERSION}-stable" >> $GITHUB_ENV
104+
# # else (beta)
105+
# - name: Beta Release
106+
# if: env.RELEASING == 'beta'
107+
# run: echo "BRANCH_NAME=main" >> $GITHUB_ENV
108+
# - name: Confirm release is either stable or beta
109+
# if: ${{ !(env.RELEASING == 'stable' || env.RELEASING == 'beta') }}
110+
# run: |
111+
# echo We seem to be releasing `${RELEASING}`.
112+
# false
113+
114+
# - name: Checkout cdn-release
115+
# uses: actions/checkout@v4
116+
# with:
117+
# repository: 'highlightjs/cdn-release'
118+
# path: 'cdn-release'
119+
# token: ${{ secrets.CDN_REPO_TOKEN }}
120+
# ref: ${{ env.BRANCH_NAME }}
121+
122+
# - name: Build CDN package
123+
# run: node ./tools/build.js -t cdn :common
124+
125+
# - name: Commmit & Push cdn-release ${{ env.TAG_NAME }}
126+
# working-directory: ./cdn-release
127+
# run: |
128+
# rm -r ./build
129+
# mv ../build/ ./build/
130+
# mv ./build/DIGESTS.md .
131+
# git config user.name github-actions
132+
# git config user.email [email protected]
133+
# git add ./build/
134+
# git add ./DIGESTS.md
135+
# git commit -m'Update to version ${{ env.TAG_NAME }}'
136+
# git tag ${TAG_NAME}
137+
# git push -f --atomic origin ${BRANCH_NAME} ${TAG_NAME}
138+
139+
# - name: Publish cdn-assets to NPM
140+
# id: publish_cdn
141+
# uses: JS-DevTools/npm-publish@v3
142+
# with:
143+
# check-version: true
144+
# token: ${{ secrets.NPM_TOKEN }}
145+
# package: ./cdn-release/build/package.json
146+
# tag: ${{ env.NPM_TAG }}
147+
148+
# # log.info('Updating CDN repo at %s' % settings.HLJS_CDN_SOURCE)
149+
# # run(['nodejs', 'tools/build.js', '--target', 'cdn', ':common'])
150+
# # os.chdir(settings.HLJS_CDN_SOURCE)
151+
# # run(['git', 'pull', '-f'])
152+
# # lines = run(['git', '--git-dir', os.path.join(settings.HLJS_CDN_SOURCE, '.git'), 'tag'])
153+
# # build_dir = os.path.join(settings.HLJS_CDN_SOURCE, 'build')
154+
# # if version in lines:
155+
# # log.info('Tag %s already exists in the local CDN repo' % version)
156+
# # else:
157+
# # if os.path.exists(build_dir):
158+
# # shutil.rmtree(build_dir)
159+
# # shutil.move(os.path.join(settings.HLJS_SOURCE, 'build'), build_dir)
160+
# # run(['git', 'add', '.'])
161+
# # run(['git', 'commit', '-m', 'Update to version %s' % version])
162+
# # run(['git', 'tag', version])
163+
# # run(['git', 'push'])
164+
# # run(['git', 'push', '--tags'])
165+
# # npm_publish(build_dir)
166+
# # os.chdir(settings.HLJS_SOURCE)

0 commit comments

Comments
 (0)