From 4352e985df71d48f3443cefe6da7d43b046764a9 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Thu, 14 Jan 2021 21:31:55 +0100 Subject: [PATCH] Add Release workflow (#164) * add workflows * adjust release workflow * adjust release workflow * remove changes * remove changes font yml --- .github/workflows/font.yml | 10 ++--- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/font.yml b/.github/workflows/font.yml index 288e0b3f1..dff159337 100644 --- a/.github/workflows/font.yml +++ b/.github/workflows/font.yml @@ -13,13 +13,13 @@ jobs: - name: Clone 'Lucide' uses: actions/checkout@v2 - + - name: Update repos run: sudo apt-get update - name: Install FontForge run: sudo apt-get install zlib1g-dev fontforge - + - name: Install NodeJS and Yarn run: sudo apt-get install nodejs yarn @@ -45,14 +45,14 @@ jobs: - name: Install Font Custom dependency run: sudo gem install fontcustom - + - name: Install "outline-stroke" run: sudo yarn add svg-outline-stroke svgson - + - name: "Outline SVG" run: mkdir converted_icons && node scripts/outline_svg.js - + - name: Build 'Lucide' run: echo "Building Lucide font" && fontcustom compile ./converted_icons -h -n Lucide -o build -F diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..9509e3edf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release to NPM + +on: + push: + tags: + - 'v*' + +jobs: + build-and-deploy: + if: github.repository == 'lucide-icons/lucide' + + runs-on: ubuntu-latest + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/\v} + + - uses: actions/checkout@v2 + with: + clean: true + + - name: Set Auth Token + run: yarn config set 'npmRegistries["//registry.npmjs.org"].npmAuthToken' ${{ secrets.NPM_TOKEN }} + + # Build lucide + - name: Install Dependencies Lucide + run: yarn --pure-lockfile + + - name: Build lucide package + run: yarn build + + # Build lucide-react + - name: Install Dependencies lucide-react + run: yarn --pure-lockfile + working-directory: packages/lucide-react + + - name: Build lucide-react + run: yarn build + working-directory: packages/lucide-react + + # Publish lucide + - name: Set package.json version lucide + run: yarn version --new-version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version + + - name: publish lucide + run: yarn publish + + # Publish lucide-react + - name: Set package.json version lucide-react + run: yarn version --new-version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version + working-directory: packages/lucide-react + + - name: publish lucide-react + run: yarn publish + working-directory: packages/lucide-react + + - name: Commit package.json + run: | + git add package.json + git add packages/lucide-react/package.json + git -c user.name="Lucide Bot" -c user.email="lucide-bot@users.noreply.github.com" \ + commit -m ":package: Bump version to ${{ steps.get_version.outputs.VERSION }}" --no-verify --quiet + git remote set-url --push origin https://lucide-bot:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git + git push origin HEAD:master +