diff --git a/.github/workflows/release-commit.yml b/.github/workflows/release-commit.yml index efcf8726e..8ffa665f7 100644 --- a/.github/workflows/release-commit.yml +++ b/.github/workflows/release-commit.yml @@ -8,7 +8,7 @@ env: PRE_RELEASE: ${{ github.event.release.prerelease}} jobs: - release-commit-pr: + unit-tests: runs-on: ubuntu-latest steps: - name: Checkout code @@ -28,9 +28,45 @@ jobs: - name: Run unit tests run: npm test + integration-tests: + runs-on: ubuntu-latest + needs: unit-tests + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.repository.default_branch }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + + - name: Install dependencies + run: npm ci + - name: Run integration tests run: npm run if-check -- -d manifests/outputs + publish: + runs-on: ubuntu-latest + needs: integration-tests + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.repository.default_branch }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + + - name: Install dependencies + run: npm ci + - name: Initialize git user email run: git config --global user.email "${{ vars.RELEASE_USER_EMAIL }}" diff --git a/src/__mocks__/fs/index.ts b/src/__mocks__/fs/index.ts index 0f37a4291..1f0ce0b7f 100644 --- a/src/__mocks__/fs/index.ts +++ b/src/__mocks__/fs/index.ts @@ -108,6 +108,9 @@ export const writeFile = async (pathToFile: string, content: string) => { } }; +export const appendFile = (file: string, appendContent: string) => + `${file}${appendContent}`; + export const stat = async (filePath: string) => { if (filePath === 'true') { return true; diff --git a/src/if-env/util/npm.ts b/src/if-env/util/npm.ts index f02898399..c5f272255 100644 --- a/src/if-env/util/npm.ts +++ b/src/if-env/util/npm.ts @@ -79,6 +79,7 @@ export const updatePackageJsonDependencies = async ( packageJsonPath, JSON.stringify(parsedPackageJson, null, 2) ); + await fs.appendFile(packageJsonPath, '\n'); }; /**