Skip to content
Open
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
32 changes: 30 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ jobs:
path: release-artifacts
- name: Prepare next release
if: github.ref_type == 'branch'
run: node --no-warnings=ExperimentalWarning --experimental-strip-types ./.scripts/prepare-next-release.ts ${{ github.run_number }} ${{ github.sha }}
run: node --no-warnings=ExperimentalWarning --experimental-strip-types ./.scripts/prepare-next-release.ts
env:
GITHUB_SHA: ${{ github.sha }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
- name: Create npm dirs
run: yarn napi create-npm-dir -t .
- name: Move artifacts
Expand Down Expand Up @@ -181,9 +185,33 @@ jobs:
else
echo "Skip publish"
fi

# set output
VERSION="$(node -p "require('./package.json').version")"
echo "es-git-version=$VERSION" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
e2e-tests:
runs-on: ubuntu-latest
needs:
- release
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
check-latest: true
- name: Install dependencies
working-directory: e2e-tests
run: npm install
- name: Run e2e tests
working-directory: e2e-tests
run: npm run test
env:
ES_GIT_VERSION: ${{ steps.publish.outputs.es-git-version }}
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
publish-docs:
runs-on: ubuntu-latest
needs:
Expand All @@ -204,4 +232,4 @@ jobs:
- name: Build Project Artifacts
run: yarn dlx vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: yarn dlx vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
run: yarn dlx vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ $RECYCLE.BIN/
*.node

# IDE
/.idea
**/.idea

# npm folders
npm
Expand Down
14 changes: 10 additions & 4 deletions .scripts/prepare-next-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ import { fileURLToPath } from 'node:url';
const dirname = path.dirname(fileURLToPath(import.meta.url));
const rootdir = path.join(dirname, '..');

const [, , build, commit] = process.argv;
if (build == null || commit == null) {
throw new Error('Invalid build/commit info');
const { GITHUB_SHA: sha, GITHUB_RUN_NUMBER: runNumber, GITHUB_RUN_ATTEMPT: runAttempt } = process.env;

if (sha == null || runNumber == null || runAttempt == null) {
throw new Error('Script should be run in GitHub Actions');
}

const build = `${runNumber}.${runAttempt}`;
const commit = sha.slice(0, 7);

const pkgFilepath = path.join(rootdir, 'package.json');
const pkg = JSON.parse(await fs.readFile(pkgFilepath, 'utf8'));
pkg.version = `${pkg.version}-next.${build}+${commit.slice(0, 7)}`;
const nextVersion = `${pkg.version}-next.${build}+${commit}`;
console.log('next version:', nextVersion);
pkg.version = nextVersion;

await fs.writeFile(pkgFilepath, `${JSON.stringify(pkg, null, 2)}${EOL}`, 'utf8');
1 change: 1 addition & 0 deletions e2e-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp/
Loading
Loading