Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) Makes pre-release version numbers incremental #462

Merged
merged 7 commits into from
Jan 30, 2025
Merged
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
106 changes: 78 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ on:
- created

env:
ESM_NAME: 'openmrs-esm-form-engine-lib'
JS_NAME: 'openmrs-esm-form-engine-lib.js'
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

steps:
- uses: actions/checkout@v4
Expand All @@ -42,7 +40,7 @@ jobs:
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ secrets.TURBO_SERVER_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}

- name: Run tests, lint and typechecking
run: yarn verify
Expand All @@ -60,28 +58,53 @@ jobs:

pirupius marked this conversation as resolved.
Show resolved Hide resolved
pre_release:
runs-on: ubuntu-latest

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v4
- name: 🛠️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Download Artifacts
uses: actions/download-artifact@v4
- name: 💾 Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Use Node.js
uses: actions/setup-node@v4
- name: 📦 Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: 🚀 Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
- run: |
yarn config set npmAlwaysAuth true
yarn config set npmAuthToken ${{ secrets.NPM_AUTH_TOKEN }}
- run: yarn npm publish --tag next
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}
- name: 🏷️ Version
run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"

- name: 🏗️ Build
run: yarn turbo run build

- name: 🔧 Configure Git
run: git config user.email "[email protected]" && git config user.name "OpenMRS CI"
- name: 💾 Commit changes
run: git add . && git commit -m "Prerelease version" --no-verify

- name: 🚀 Pre-release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename this to Publish Pre-release

run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: 📤 Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist
overwrite: true

release:
runs-on: ubuntu-latest
Expand All @@ -92,14 +115,41 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download Artifacts
- name: 📥 Download Artifacts
uses: actions/download-artifact@v4
- name: Use Node.js
- name: 🛠️ Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag latest
node-version: "18"

- name: 💾 Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: 📦 Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: 🚀 Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}

- name: 🏗️ Build
run: yarn turbo run build
- name: 🚀 Publish to NPM
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: 📤 Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist
overwrite: true