From 191950fdc83584f904d20d8d3f2dadfbd49403ce Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Thu, 22 Aug 2024 15:33:26 -0300 Subject: [PATCH] ci: add workflows --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++ .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++ .github/workflows/pr.yml | 35 +++++++++++++++++++++++++ package-lock.json | 4 +-- package.json | 2 +- 5 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e0cebe8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - '*' + - '*/*' + +concurrency: + group: ${{ github.event.number }} + cancel-in-progress: true + +jobs: + code-checks: + name: Code Checks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Clean and Install + run: npm ci + - name: Build + run: npm run build + #- name: Lint + # run: npm run lint + #- name: Unit tests + # run: npm run test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cdc127b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: Main + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + release: + name: Auto release + runs-on: ubuntu-latest + outputs: + version: ${{ steps.changelog.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT }} + fetch-depth: 0 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Conventional Changelog Update + uses: TriPSs/conventional-changelog-action@v5 + id: changelog + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + output-file: 'CHANGELOG.md' + skip-version-file: 'true' + skip-commit: 'true' + git-push: 'false' + skip-on-empty: 'false' + - name: Set new version + run: | + echo "::set-output name=version::${{ steps.changelog.outputs.version }}" + npm version minor + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + author_name: Ci Bot + author_email: cibot@users.noreply.github.com + message: 'doc: updating pom to ${{ steps.changelog.outputs.version }} [ci skip]' + add: '["packages.json","CHANGELOG.md"]' + - name: Create Release + uses: ncipollo/release-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag: ${{ steps.changelog.outputs.tag }} + name: ${{ steps.changelog.outputs.tag }} + body: ${{ steps.changelog.outputs.clean_changelog }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..7d36499 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,35 @@ +name: PR + +on: + push: + branches: + - '*' + - '*/*' + +concurrency: + group: ${{ github.event.number }} + cancel-in-progress: true + +jobs: + code-checks: + name: Code Checks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Clean and Install + run: npm ci + - name: Build + run: npm run build + #- name: Lint + # run: npm run lint + #- name: Unit tests + # run: npm run test diff --git a/package-lock.json b/package-lock.json index 3222de7..f4548e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "12_todo_react", - "version": "0.1.0", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "12_todo_react", - "version": "0.1.0", + "version": "1.0.0", "dependencies": { "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", diff --git a/package.json b/package.json index 82e936e..636c7d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "12_todo_react", - "version": "0.1.0", + "version": "1.0.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.16.5",