Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .github/workflows/release-validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Validate Release

on:
pull_request:
types:
- opened
- synchronize
branches:
- 'release/'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
test-coverage:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ steps.node-version.outputs.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Lint
run: yarn lint
- name: Format
run: yarn format
- name: Build
run: yarn build
- name: Test Coverage
run: yarn test:coverage
- name: Create badges
run: |
echo "Update badges readme file"
yarn readme:coverage
- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-files
path: |
app/coverage
app/test/badges

tag:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Extract branch tag
id: tag
run: |
BRANCH=${{ github.head_ref }}
TAG="${BRANCH//release\//}"
echo $TAG
echo "tag=$TAG" >> $GITHUB_OUTPUT

update-version:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
needs:
- tag
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
env:
TAG: ${{ needs.tag.outputs.tag }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Update version in package.json
run: |
jq '.version = "${{ env.TAG }}"' package.json > temp.json && mv temp.json package.json
- name: Upload updated package.json
uses: actions/upload-artifact@v4
with:
name: updated-package-json
path: app/package.json

commit-push:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
needs:
- test-coverage
- tag
runs-on: ubuntu-latest
steps:
- name: Download coverage files
uses: actions/download-artifact@v4
with:
name: coverage-files
path: app
- name: Download updated package.json
uses: actions/download-artifact@v4
with:
name: updated-package-json
path: app
- name: Commit and push changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@github.com"

git checkout -B ${{ github.head_ref }} || git checkout -b ${{ github.head_ref }}

echo "Commit update version to '${{ env.TAG }}' and test coverage badges"
git add .
git commit -m "chore: update version to '${{ env.TAG }}' and test coverage badges"

git pull origin ${{ github.head_ref }} --rebase

git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}.git ${{ github.head_ref }}
64 changes: 0 additions & 64 deletions .github/workflows/update-version-package-json.yaml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Validate Pull Request

on:
pull_request:
types:
- opened
- synchronize
branches:
- main
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate-pr:
if: ${{ github.event.pull_request.base.ref != 'develop' || github.event.pull_request.head.ref != 'main' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ steps.node-version.outputs.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Lint
run: yarn lint
- name: Format
run: yarn format
- name: Build
run: yarn build
- name: Test
run: yarn test
76 changes: 0 additions & 76 deletions .github/workflows/validate.yml

This file was deleted.

Loading