Skip to content

Commit

Permalink
chore: Update GitHub workflows for builds and releases (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
codemile authored Jun 1, 2024
1 parent abf6f35 commit 3e2517a
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: "🔧 Deploy to GitHub"

name: "🔨 Build"
on:
# When you push changes: only affected projects will be build/deploy
push:
branches:
- main
- v2.0.x
# When you manually trigger: all projects will be build/deploy
workflow_dispatch:

concurrency: "deploy"
concurrency: "build"

jobs:
install:
Expand Down Expand Up @@ -72,8 +70,7 @@ jobs:

build:
runs-on: ubuntu-latest
#needs: [ lint, test, storybooks ]
needs: [ lint ]
needs: [ install ]
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: "🚀 Release"

on:
release:
types:
- prereleased
- released

concurrency: "release"

jobs:
install:
runs-on: ubuntu-latest
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4

- name: "📦 Install dependencies"
uses: reactgular/cache@v1
with:
mode: "install"

lint:
runs-on: ubuntu-latest
needs: [ install ]
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@v1
with:
mode: "restore"

- name: "🔨 Lint"
run: yarn lint

test:
runs-on: ubuntu-latest
needs: [ install ]
if: false
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@v1
with:
mode: "restore"

- name: "🔨 Test"
run: ${{ env.NX }} affected -t test

storybooks:
runs-on: ubuntu-latest
needs: [ install ]
if: false
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@main
with:
mode: "restore"

- name: "🔨 Build storybooks"
run: yarn build-storybook

check-version:
runs-on: ubuntu-latest
needs: [ install ]
steps:
- name: "🔍 Check package.json version"
id: check_version
run: |
PACKAGE_VERSION=$(jq -r .version < package.json)
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
if [ "${PACKAGE_VERSION}" != "${RELEASE_VERSION}" ]; then
echo "Version mismatch: package.json version (${PACKAGE_VERSION}) does not match release version (${RELEASE_VERSION})"
exit 1
else
echo "Version matches: package.json version (${PACKAGE_VERSION}) matches release version (${RELEASE_VERSION})"
fi
build:
runs-on: ubuntu-latest
needs: [ install ]
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@v1
with:
mode: "restore"

- name: "🔨 Build projects"
run: yarn build

0 comments on commit 3e2517a

Please sign in to comment.