Beta Release #21
Workflow file for this run
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: Beta Release | |
on: | |
workflow_dispatch: # This allows manual triggering only from the Actions tab | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout DIVE | |
uses: actions/checkout@main | |
- name: Setup Node.js | |
uses: actions/setup-node@main | |
- name: Search for cached dependencies | |
uses: actions/cache@main | |
id: yarn-cache | |
with: | |
path: node_modules | |
key: | |
node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install DIVE dependencies (if cache not found) | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn | |
eslint: | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
- name: Checkout DIVE | |
uses: actions/checkout@main | |
- name: Search for cached dependencies | |
uses: actions/cache@main | |
id: yarn-cache | |
with: | |
path: node_modules | |
key: | |
node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install DIVE dependencies (if cache not found) | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Lint DIVE | |
run: yarn lint | |
unit: | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
- name: Checkout DIVE | |
uses: actions/checkout@main | |
- name: Search for cached dependencies | |
uses: actions/cache@main | |
id: yarn-cache | |
with: | |
path: node_modules | |
key: | |
node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install DIVE dependencies (if cache not found) | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Unit-Test DIVE | |
run: yarn unit | |
prettier-fix: | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
- name: Checkout DIVE | |
uses: actions/checkout@main | |
- name: Search for cached dependencies | |
uses: actions/cache@main | |
id: yarn-cache | |
with: | |
path: node_modules | |
key: | |
node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install DIVE dependencies (if cache not found) | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Prettier fix DIVE | |
run: yarn prettier:fix && git add . | |
publish-beta: | |
runs-on: ubuntu-latest | |
needs: [eslint, unit, prettier-fix] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Search for cached dependencies | |
uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: node_modules | |
key: | |
node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies (if cache not found) | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Register git user | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Check existing beta versions | |
id: beta-branch-check | |
run: | | |
current_version=$(node -p "require('./package.json').version") | |
prefix="beta/v$current_version-beta" | |
last_beta=$(git tag | grep "^${prefix}" | sort -V | tail -n 1) | |
if [ -z "$last_beta" ]; then | |
next_beta="${prefix}.1" | |
else | |
beta_number=$(echo $last_beta | awk -F '.' '{print $NF}') | |
next_beta="${prefix}.$((beta_number + 1))" | |
fi | |
echo "next_beta=$next_beta" >> $GITHUB_ENV | |
- name: Bump to next beta version | |
run: | | |
new_version=$(echo $next_beta | sed 's|beta/v||') | |
npm version $new_version --no-git-tag-version | |
git add package.json | |
- name: Create beta branch | |
run: | | |
git checkout -b ${{ env.next_beta }} | |
- name: Build DIVE | |
run: yarn build | |
- name: Add build files | |
run: git add ./build -f | |
- name: Commit changes | |
run: | | |
git commit -m "Beta v$(node -p "require('./package.json').version")" | |
git tag -a v$(node -p "require('./package.json').version") -m "Beta v$(node -p "require('./package.json').version")" | |
- name: Push changes | |
run: | | |
git push origin beta/v$(node -p "require('./package.json').version") --follow-tags | |
- name: Authenticate with NPM | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc | |
- name: Publish Beta tag to npm | |
run: | | |
yarn publish --tag beta |