chore: refactor actions workflows (#222)

This commit is contained in:
Pascal Jufer 2022-12-08 17:06:02 +01:00 committed by GitHub
parent d3179c5825
commit 3ea613b934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 123 additions and 66 deletions

View file

@ -9,23 +9,41 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
# Skip job on forks
if: github.repository_owner == 'iconoir-icons'
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2.1.0
with:
version: 7.8.0
run_install: true
- run: pnpm run build
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update build artifacts
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update build artifacts

View file

@ -10,46 +10,68 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: main # We have to checkout main or PNPM fails. Tag should be on main anyway.
- uses: actions/cache@v2
# We have to checkout main or PNPM fails. Tag should be on main anyway.
ref: main
- name: Setup Node.js
uses: actions/setup-node@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: 16
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2.1.0
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7.8.0
run_install: true
- uses: rhysd/changelog-from-release/action@v2
version: 7
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- uses: rhysd/changelog-from-release/action@v3
with:
file: packages/iconoir-flutter/CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
commit: false
- run: pnpm run build
- run: pnpm run prepublish-all
- name: Build
run: pnpm run build
- name: Prepare packages
run: pnpm run prepublish-all
env:
TAG_NAME: ${{ github.ref_name }}
- uses: stefanzweifel/git-auto-commit-action@v4
- name: Commit release
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Release Version ${{ github.ref_name }}
branch: main
- run: git -c user.email="actions@github.com" -c user.name="GitHub Actions" tag -fa ${{ github.ref_name }} -m "${{ github.ref_name }}"
- run: git push -f origin ${{ github.ref_name }}
- run: npm publish --access public
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm -r publish --filter './packages/**' --access public
continue-on-error: true
- name: Update tag
run: |
git -c user.email="actions@github.com" -c user.name="GitHub Actions" tag -fa ${{ github.ref_name }} -m "${{ github.ref_name }}"
git push -f origin ${{ github.ref_name }}
- name: Publish packages
run: pnpm -r publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - uses: sakebook/actions-flutter-pub-publisher@v1.4.0
# with:
# credential: ${{ secrets.PUB_CREDENTIAL_JSON }}

View file

@ -17,45 +17,63 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
ref: main # We have to checkout main or PNPM fails. Tag should be on main anyway.
- uses: actions/cache@v2
node-version: 16
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
version: 7
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2.1.0
with:
version: 7.8.0
run_install: true
- name: Build Packages
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build packages
run: pnpm run dist
- name: Build
- name: Build website
run: ./node_modules/.bin/next build
working-directory: iconoir.com
- name: Export
- name: Export website
run: ./node_modules/.bin/next export
working-directory: iconoir.com
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Setup GitHub Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './iconoir.com/out'
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment

View file

@ -1,6 +1,5 @@
{
"name": "iconoir.com",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",