Publish library #509
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: Publish library | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths: | |
- 'assets/**' | |
env: | |
LIBRARY_VERSION: 1.1.${{ github.run_number }} | |
jobs: | |
publish-library: | |
if: "!contains(github.event.head_commit.author.email, 'flubuild@microsoft.com')" | |
name: Publish icon libraries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.CI_GITHUB_TOKEN }} | |
- name: Bump version patch | |
run: | | |
grep -E "[0-9]+\.[0-9]+\.[0-9]+" FluentIcons.podspec | python3 -c """ | |
import sys | |
import os | |
current_version = sys.stdin.read().strip().split(\"'\")[1] | |
major, minor, patch = current_version.split('.') | |
os.system(f'echo \"NEW_VERSION={major}.{minor}.{int(patch) + 1}\" >> \$GITHUB_ENV') | |
""" | |
- name: Bump react version patch | |
run: | | |
grep -E "[0-9]+\.[0-9]+\.[0-9]+" ./packages/react-icons/package.json | python3 -c """ | |
import sys | |
import os | |
current_version = sys.stdin.read().strip().split(':')[1] | |
current_version = current_version.split('\"')[1] | |
major,minor,asset = current_version.split('.') | |
os.system(f'echo \"REACT_VERSION={major}.{minor}.{int(asset) + 1}\" >> \$GITHUB_ENV') | |
""" | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in react-native-icons/package.json | |
run: | | |
sed -i.bk -r "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?(-rc\.[0-9]+)?\"/\"version\": \"$REACT_VERSION\"/g" packages/react-native-icons/package.json | |
rm packages/react-native-icons/package.json.bk | |
- name: Use Node 18 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- run: npm install | |
working-directory: importer | |
## iOS | |
- name: Run iOS generate script | |
run: npm run deploy:ios | |
working-directory: importer | |
## Flutter | |
- name: Run Flutter generate script | |
run: npm run deploy:flutter | |
working-directory: importer | |
# The name should be same as the package name on pub.dev | |
- name: 'fluentui_system_icons' | |
uses: k-paxian/dart-package-publisher@master | |
with: | |
relativePath: 'flutter' | |
skipTests: true | |
accessToken: ${{ secrets.FLUTTER_OAUTH_ACCESS_TOKEN }} | |
refreshToken: ${{ secrets.FLUTTER_OAUTH_REFRESH_TOKEN }} | |
## Publish | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version numbers in README.md | |
run: | | |
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" README.md | |
rm README.md.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version numbers in ios/README.md | |
run: | | |
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" ios/README.md | |
rm ios/README.md.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in Podspec | |
run: | | |
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" ios/FluentIcons.podspec | |
rm ios/FluentIcons.podspec.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in flutter/CHANGELOG.md | |
run: | | |
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" flutter/CHANGELOG.md | |
rm flutter/CHANGELOG.md.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in flutter/pubspec.yaml | |
run: | | |
sed -i.bk -r "s/version: [0-9]+\.[0-9]+\.[0-9]+/version: $NEW_VERSION/g" flutter/pubspec.yaml | |
rm flutter/pubspec.yaml.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in svg-icons/package.json | |
run: | | |
sed -i.bk -r "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$NEW_VERSION\"/g" packages/svg-icons/package.json | |
rm packages/svg-icons/package.json.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in svg-sprites/package.json | |
run: | | |
sed -i.bk -r "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$NEW_VERSION\"/g" packages/svg-sprites/package.json | |
rm packages/svg-sprites/package.json.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in react-icons/package.json | |
run: | | |
sed -i.bk -r "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?(-rc\.[0-9]+)?\"/\"version\": \"$REACT_VERSION\"/g" packages/react-icons/package.json | |
rm packages/react-icons/package.json.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in react-native-icons/package.json | |
run: | | |
sed -i.bk -r "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$REACT_VERSION\"/g" packages/react-native-icons/package.json | |
rm packages/react-native-icons/package.json.bk | |
# Needs to be "-E" instead of "-r" on macOS | |
- name: Replace version number in react-icons-font-subsetting-webpack-plugin/package.json | |
run: | | |
sed -i.bk -r "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?(-rc\.[0-9]+)?\"/\"version\": \"$REACT_VERSION\"/g" packages/react-icons-font-subsetting-webpack-plugin/package.json | |
rm packages/react-icons-font-subsetting-webpack-plugin/package.json.bk | |
- name: Install dependencies | |
run: npm install | |
- name: Build SVG library | |
run: | | |
npm run build | |
working-directory: packages/svg-icons | |
- name: Build SVG sprite library | |
run: | | |
npm run build | |
working-directory: packages/svg-sprites | |
- name: Build React library | |
run: | | |
npm run build | |
working-directory: packages/react-icons | |
- name: Build Webpack plugin library | |
run: | | |
npm run build | |
working-directory: packages/react-icons-font-subsetting-webpack-plugin | |
- name: Build React-Native library | |
run: | | |
npm run build | |
working-directory: packages/react-native-icons | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
package: packages/svg-icons/package.json | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
package: packages/svg-sprites/package.json | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
package: packages/react-icons/package.json | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
package: packages/react-icons-font-subsetting-webpack-plugin/package.json | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
package: packages/react-native-icons/package.json | |
## Android | |
# - name: Run Android generate script | |
# env: | |
# # see https://github.com/JS-DevTools/npm-publish/issues/15 | |
# INPUT_TOKEN: '' | |
# run: npm run deploy:android | |
# working-directory: importer | |
# - name: Setup Java | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 8 | |
# - name: Base64 decodes and pipes the GPG key content into the secret file | |
# env: | |
# GPG_KEY_CONTENT: ${{ secrets.GPG_KEY_CONTENT }} | |
# SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
# run: | | |
# git fetch --unshallow | |
# sudo bash -c "echo '$GPG_KEY_CONTENT' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'" | |
# - name: Build Android library | |
# uses: eskatos/gradle-command-action@v1 | |
# with: | |
# arguments: assembleRelease -DversionName='${{ env.NEW_VERSION }}' | |
# build-root-directory: android | |
# wrapper-directory: android | |
# Temporarily commenting out the publishing to Maven Central, as it is blocking the release for other platforms | |
# - name: Publish to Maven Central | |
# uses: eskatos/gradle-command-action@v1 | |
# env: | |
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
# OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
# GPG_SIGNING_KEY_ID: ${{ secrets.GPG_SIGNING_KEY_ID }} | |
# GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
# SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
# SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
# VERSION_NAME: ${{ env.NEW_VERSION }} | |
# with: | |
# arguments: publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository | |
# build-root-directory: android | |
# wrapper-directory: android | |
# - name: Generate BUILD.gn file for Android | |
# run: python3 generate_build_gn_android.py | |
# working-directory: importer | |
- name: Update icon sheet | |
run: python3 generate_icons_md.py | |
- name: Config git credentials | |
run: git config user.email "flubuild@microsoft.com" && git config user.name "Fluent Build System" | |
- name: Commit version number change | |
run: | | |
git add -A | |
git commit -m "Release $NEW_VERSION" | |
- name: Tag release | |
run: git tag "$NEW_VERSION" | |
- name: Push release | |
run: | | |
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
git push $REMOTE_REPO HEAD:main --follow-tags --tags | |
# publish-android-demo: | |
# name: Publish Android demo app | |
# runs-on: ubuntu-latest | |
# needs: publish-library | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Bump version patch | |
# run: | | |
# grep -E "[0-9]+\.[0-9]+\.[0-9]+" FluentIcons.podspec | python3 -c """ | |
# import sys | |
# import os | |
# current_version = sys.stdin.read().strip().split(\"'\")[1] | |
# major, minor, patch = current_version.split('.') | |
# os.system(f'echo \"NEW_VERSION={major}.{minor}.{int(patch) + 1}\" >> \$GITHUB_ENV') | |
# """ | |
# - name: Use Node 11 | |
# uses: actions/setup-node@v1 | |
# with: | |
# node-version: 11.x | |
# - run: npm install | |
# working-directory: importer | |
# - name: Run generate script | |
# run: npm run deploy:android | |
# working-directory: importer | |
# - name: Setup Java | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 8 | |
# - name: Restore release keystore | |
# run: | | |
# echo "${{ secrets.ANDROID_KEYSTORE }}" > release.keystore.asc | |
# gpg -d --passphrase "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" --batch release.keystore.asc > release.keystore | |
# - name: Build Android demo app | |
# uses: eskatos/gradle-command-action@v1 | |
# with: | |
# arguments: ':sample-showcase:assembleRelease -DversionName=${{ env.NEW_VERSION }} -DversionCode=${{ github.run_number }} -Pandroid.injected.signing.store.file=/home/runner/work/fluentui-system-icons/fluentui-system-icons/release.keystore -Pandroid.injected.signing.store.password=${{ secrets.ANDROID_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.ANDROID_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}' | |
# build-root-directory: android | |
# wrapper-directory: android | |
# - name: Publish apk to App Center | |
# uses: wzieba/AppCenter-Github-Action@v1.0.0 | |
# with: | |
# appName: ${{ secrets.APP_CENTER_DEMO_APP_NAME }} | |
# token: ${{ secrets.APP_CENTER_TOKEN }} | |
# group: Public | |
# file: android/sample-showcase/build/outputs/apk/release/sample-showcase-release.apk | |
# releaseNotes: Please enjoy this latest version(${{ env.NEW_VERSION }}) of Fluent System Icons Demo. |