Add files via upload #201
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
name: page | |
on: | |
push: | |
branches-ignore: | |
- gh-pages | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prerequist | |
run: sudo apt update && sudo apt install -y woff2 fontforge ttfautohint jq inkscape # better svg rendering for montage | |
- name: Build | |
run: | | |
make all METADATA.pb solid.png | |
for svg in solid/*.svg; do echo $svg | sed 's|[.].*|.svg|;s|^.*/|solid/|' | xargs mv $svg; done | |
ls solid/*.svg | sed s/.svg/.png/ | xargs make | |
- name: Release | |
run: | | |
TAG=$(date +v%y.%m.%d) | |
message=$(git log -1 --pretty=format:"%s") | |
[[ "$message" == "[WIP]"* ]] && exit; | |
page=$(curl -v -u:${PERSONAL_TOKEN} -H "Content-Type:application/json" -d '{"tag_name": "'$TAG'"}' https://api.github.com/repos/${GITHUB_REPOSITORY}/releases) | |
echo page is "$page" | |
upload_url=$(echo "$page" | jq -r .upload_url) | |
echo upload on $upload_url | |
for f in solid.*; do | |
curl -u:${PERSONAL_TOKEN} -H "Content-Type: $(file -b --mime-type $f)" --data-binary @$f ${upload_url/{*}?name=$f | jq .browser_download_url | |
done | |
curl -HAccept:application/vnd.github.mercy-preview+json https://api.github.com/repos/${GITHUB_REPOSITORY} | | |
jq '{name,version:"'$TAG'",main:"solid.woff2",description,homepage,author:.owner.login,license:.license.key,repository:{type:"git",url:.git_url},keywords:.topics}' > package.json | |
- name: Page | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git remote add origin_token "https://x-access-token:${PERSONAL_TOKEN}@github.com/$GITHUB_REPOSITORY.git" | |
git checkout -b gh-pages | |
git add . | |
git commit -m "$(date -u) ${GITHUB_SHA}" | |
git push origin_token --force | |
# NpmPackage | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '12.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: NPM | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |