-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow: Publish Data #980
Open
lianghai
wants to merge
13
commits into
unicode-org:main
Choose a base branch
from
lianghai:publish-ucd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f85bd3f
Workflow for publishing UCD
lianghai 4d7cad1
Alpha mode
lianghai 97e269c
Revise shell script
lianghai 273655e
Customize run-name; try sparse-checkout
lianghai 55166cd
Beta mode; organize code
lianghai 73c74f1
Flatten control flow
lianghai 24bfa68
Reluctantly restore deleted files
lianghai a4691eb
Rename workflow files
lianghai 03710ab
Workflow renaming, mode → release phase, dist → TMP=pub/tmp
lianghai 607cfa8
Set COPY_YEAR to current year; use UTC time and macOS-compatible format
lianghai 5bb2e08
Document Gregg as Rick’s replacement, and existence of publish-data.yml
lianghai a6fc78e
Use the [[ syntax in place of [
lianghai 7004cd7
Correct $TMP creation
lianghai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# See publish-data.yml | ||
|
||
TMP=pub/tmp | ||
mkdir $TMP | ||
|
||
COPY_YEAR=$(date -u +%Y) | ||
PUB_DATE=$(date -u +%Y-%m-%d) | ||
|
||
cat > $TMP/sed-readmes.txt << eof | ||
s/COPY_YEAR/$COPY_YEAR/ | ||
s/PUB_DATE/$PUB_DATE/ | ||
s/PUB_STATUS/draft/ | ||
s/UNI_VER/$UNI_VER/ | ||
s/EMOJI_VER/$EMOJI_VER/ | ||
s/TR10_REV/$TR10_REV/ | ||
s%PUBLIC_EMOJI%Public/draft/emoji% | ||
s%PUBLIC_UCD%Public/draft/UCD% | ||
eof | ||
|
||
mkdir $TMP/UCD | ||
cp -R unicodetools/data/ucd/dev $TMP/UCD/ucd | ||
mv $TMP/UCD/ucd/version-ReadMe.txt $TMP/UCD/ReadMe.txt | ||
rm -r $TMP/UCD/ucd/Unihan | ||
|
||
if [ "$RELEASE_PHASE" = "Dev" ]; then | ||
rm -r $TMP/UCD/ucd/emoji | ||
fi | ||
|
||
if [ "$RELEASE_PHASE" = "Alpha" ] || [ "$RELEASE_PHASE" = "Beta" ]; then | ||
cp -R unicodetools/data/emoji/dev $TMP/emoji | ||
|
||
cp -R unicodetools/data/idna/dev $TMP/idna | ||
|
||
mkdir $TMP/idna2008derived | ||
cp unicodetools/data/idna/idna2008derived/ReadMe.txt $TMP/idna2008derived | ||
cp unicodetools/data/idna/idna2008derived/Idna2008-$UNI_VER.txt $TMP/idna2008derived | ||
fi | ||
|
||
if [ "$RELEASE_PHASE" = "Beta" ]; then | ||
cp -R unicodetools/data/uca/dev $TMP/UCA | ||
sed -i -f $TMP/sed-readmes.txt $TMP/UCA/CollationTest.html | ||
|
||
cp -R unicodetools/data/security/dev $TMP/security | ||
fi | ||
|
||
# Update the readmes in-place (-i) as set up above. | ||
find $TMP -name '*ReadMe.txt' | xargs sed -i -f $TMP/sed-readmes.txt | ||
rm $TMP/sed-readmes.txt | ||
|
||
mkdir $TMP/zipped | ||
mv $TMP/UCD/ucd/zipped-ReadMe.txt $TMP/zipped/ReadMe.txt | ||
(cd $TMP/UCD/ucd; zip -r UCD.zip *) | ||
mv $TMP/UCD/ucd/UCD.zip $TMP/zipped | ||
|
||
if [ "$RELEASE_PHASE" = "Beta" ]; then | ||
(cd $TMP/UCA; zip -r CollationTest.zip CollationTest; rm -r CollationTest) | ||
|
||
(cd $TMP/security; zip -r uts39-data-$UNI_VER.zip *) | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# See https://github.com/unicode-org/unicodetools/blob/main/docs/data-workflow.md#publication | ||
|
||
# Test locally with https://github.com/nektos/act: | ||
# act --workflows .github/workflows/publish-data.yml --input releasePhase=Alpha | ||
|
||
name: Publish Data | ||
|
||
run-name: "${{ github.workflow }}: ${{ inputs.releasePhase }}" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releasePhase: # See ReleasePhase in https://github.com/unicode-org/unicodetools/blob/main/unicodetools/src/main/java/org/unicode/text/utility/Settings.java | ||
description: Release phase | ||
type: choice | ||
options: | ||
- Dev | ||
- Alpha | ||
- Beta | ||
default: Dev | ||
|
||
env: | ||
UNI_VER: "17.0.0" | ||
EMOJI_VER: "17.0" | ||
TR10_REV: "tr10-52" # UTS #10 release revision number to be used in CollationTest.html: One more than the last release revision number. | ||
RELEASE_PHASE: ${{ inputs.releasePhase }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
.github/workflows | ||
unicodetools/data/ucd/dev | ||
unicodetools/data/emoji/dev | ||
unicodetools/data/idna/dev | ||
unicodetools/data/idna/idna2008derived | ||
- run: .github/workflows/publish-data.sh | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: pub/tmp # See TMP in publish-data.sh |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would normally go with bash conditional expressions (with
[[
]]
) rather than thetest
command (aka[
).@markusicu, I am unsure about our bash style here, which one do we prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn’t familiar with the difference between
[
and[[
, but now after some reading I do prefer[[
as it offers an experience similar to modern languages. Made the change.