From 68f82db1425fa424563330928e835fa3377e1e41 Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Wed, 18 Sep 2024 09:52:54 -0700 Subject: [PATCH] ci: updating workflows --- .github/workflows/ci.yml | 34 ----------- .github/workflows/merge.yml | 116 ++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/merge.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4534d71..f8c09ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - main - push: - branches: - - main permissions: contents: read @@ -86,34 +83,3 @@ jobs: echo "The output does not match the expected feature" exit 1 fi - - publish: - name: Publish - runs-on: ubuntu-22.04 - needs: [test-action, test-typescript] - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - - name: Conventional Changelog Update - uses: TriPSs/conventional-changelog-action@v5 - id: changelog - with: - github-token: ${{ github.token }} - output-file: 'CHANGELOG.md' - skip-version-file: 'true' - skip-commit: 'true' - git-push: 'true' - - - name: Create Release - uses: softprops/action-gh-release@v2 - if: ${{ steps.changelog.outputs.tag != '' }} - continue-on-error: true - env: - GITHUB_TOKEN: ${{ github.token }} - with: - token: ${{ github.token }} - tag_name: ${{ steps.changelog.outputs.tag }} - name: ${{ steps.changelog.outputs.tag }} - body: ${{ steps.changelog.outputs.clean_changelog }} diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml new file mode 100644 index 0000000..29efca6 --- /dev/null +++ b/.github/workflows/merge.yml @@ -0,0 +1,116 @@ +name: Continuous Integration + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + test-typescript: + name: TypeScript Tests + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + id: setup-node + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + + - name: Install Dependencies + id: npm-ci + run: npm ci + + - name: Check Format + id: npm-format-check + run: npm run format:check + + - name: Lint + id: npm-lint + run: npm run lint + + - name: Test + id: npm-ci-test + run: npm run coverage + + test-action: + name: GitHub Actions Test + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + id: setup-node + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + + - name: Install Dependencies + id: npm-ci + run: npm ci + + - name: Build + id: npm-build + run: npm run package + + - name: Test Local Action + id: test-action + uses: ./ + with: + issue: 1 + + - name: Print Output + id: output + run: echo "${{ steps.test-action.outputs.feature }}" + + - name: Validate Feature + id: validate + run: | + # Check if the content of the output is the same as the .github/sample.feature file + if [ "$(cat .github/sample.feature)" != "${{ steps.test-action.outputs.feature }}" ]; then + echo "The output does not match the expected feature" + exit 1 + fi + + publish: + name: Publish + runs-on: ubuntu-22.04 + needs: [test-action, test-typescript] + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Conventional Changelog Update + uses: TriPSs/conventional-changelog-action@v5 + id: changelog + with: + github-token: ${{ github.token }} + output-file: 'CHANGELOG.md' + skip-version-file: 'true' + skip-commit: 'true' + git-push: 'true' + + - name: Create Release + uses: softprops/action-gh-release@v2 + if: ${{ steps.changelog.outputs.tag != '' }} + continue-on-error: true + env: + GITHUB_TOKEN: ${{ github.token }} + with: + token: ${{ github.token }} + tag_name: ${{ steps.changelog.outputs.tag }} + name: ${{ steps.changelog.outputs.tag }} + body: ${{ steps.changelog.outputs.clean_changelog }}