From fc4c16dd9b531599647b491bd1bbb118f6cd24c6 Mon Sep 17 00:00:00 2001 From: Patrick Dreker Date: Wed, 23 Nov 2022 14:02:43 +0100 Subject: [PATCH] fix: add testcase for new + pre-release --- .github/workflows/test.yml | 304 +++++++++++++++++++++---------------- 1 file changed, 169 insertions(+), 135 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 427305f..07b4762 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: 'Test the action' +name: "Test the action" on: pull_request: branches: @@ -24,11 +24,11 @@ jobs: id: changelog uses: ./ env: - ENV: 'dont-use-git' - EXPECTED_TAG: 'v1.5.0' + ENV: "dont-use-git" + EXPECTED_TAG: "v1.5.0" with: github-token: ${{ secrets.github_token }} - version-file: 'test-file.json' + version-file: "test-file.json" - name: Show file run: | @@ -38,7 +38,7 @@ jobs: run: node ./test-github-output.js env: TAG: ${{ steps.changelog.outputs.tag }} - EXPECTED_TAG: 'v1.5.0' + EXPECTED_TAG: "v1.5.0" test-json: runs-on: ubuntu-latest @@ -58,11 +58,11 @@ jobs: id: changelog uses: ./ env: - ENV: 'dont-use-git' - EXPECTED_TAG: 'v1.5.0' + ENV: "dont-use-git" + EXPECTED_TAG: "v1.5.0" with: github-token: ${{ secrets.github_token }} - version-file: 'test-file.json' + version-file: "test-file.json" - name: Show file run: | @@ -71,8 +71,8 @@ jobs: - name: Test output run: node ./test-output.js env: - FILES: 'test-file.json' - EXPECTED_VERSION: '1.5.0' + FILES: "test-file.json" + EXPECTED_VERSION: "1.5.0" test-json-new: runs-on: ubuntu-latest @@ -92,11 +92,11 @@ jobs: id: changelog uses: ./ env: - ENV: 'dont-use-git' - EXPECTED_TAG: 'v0.1.0' + ENV: "dont-use-git" + EXPECTED_TAG: "v0.1.0" with: github-token: ${{ secrets.github_token }} - version-file: 'test-file-new.json' + version-file: "test-file-new.json" - name: Show file run: | @@ -105,8 +105,43 @@ jobs: - name: Test output run: node ./test-output.js env: - FILES: 'test-file-new.json' - EXPECTED_VERSION: '0.1.0' + FILES: "test-file-new.json" + EXPECTED_VERSION: "0.1.0" + + test-json-new-prerelease: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: "./" + + - run: npm ci --prod + + - run: "git config --global user.email 'changelog@github.com'" + - run: "git config --global user.name 'Awesome Github action'" + - run: "git add . && git commit --allow-empty -m 'feat: Added fake file so version will be bumped'" + + - name: Generate changelog + id: changelog + uses: ./ + env: + ENV: "dont-use-git" + EXPECTED_TAG: "v0.1.0-rc.0" + with: + github-token: ${{ secrets.github_token }} + version-file: "test-file-new-prerelease.json" + pre-release: true + + - name: Show file + run: | + echo "$(