diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..2e5ea23 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,53 @@ +name: cd + +on: + push: + branches: + - main + repository_dispatch: + types: [ 'deploy' ] + workflow_dispatch: + +jobs: + cd: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-file: 'package.json' + + - name: Install + run: npm ci + + - name: Test + run: npm test + + - name: Build + run: npm run build + + - name: Semantic Release + id: semantic + uses: cycjimmy/semantic-release-action@v3 + with: + semantic_version: 23 + extra_plugins: | + @semantic-release/changelog@6 + @semantic-release/git@10 + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + cname: metro-travel.vincenthardouin.dev \ No newline at end of file diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..c78176a --- /dev/null +++ b/.releaserc @@ -0,0 +1,27 @@ +{ + "branches": [ + "main" + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "docs/CHANGELOG.md" + } + ], + "@semantic-release/github", + [ + "@semantic-release/git", + { + "assets": [ + "package.json", + "package-lock.json", + "docs/CHANGELOG.md" + ], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] + ] +} \ No newline at end of file