diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5485192b..34647f59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,56 +1,38 @@ name: 'Continuous Integration' on: - push: - branches: - - main - - dev - pull_request_target: - branches: - - main - - dev + workflow_call: permissions: checks: write contents: read -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true - jobs: ci: runs-on: ubuntu-latest steps: - - name: Check out repository ✨ - if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'pull_request_target' && github.actor != 'dependabot[bot]' }} + - name: Check out repository ✨ (non dependabot) + if: ${{ github.actor != 'dependabot[bot]' }} uses: actions/checkout@v4 + - name: Check out repository 🎉 (dependabot) - if: ${{ github.event_name == 'pull_request_target' }} + if: ${{ github.actor == 'dependabot[bot]' }} uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Setup node env 📦 uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' check-latest: true cache: 'npm' + - name: Install dependencies 🚀 - run: npm ci --prefer-offline --no-audit --unsafe-perm=true + run: npm ci --prefer-offline --no-audit + - name: Run linter(s) 👀 - uses: wearerequired/lint-action@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - continue_on_error: false - git_name: github-actions[bot] - git_email: github-actions[bot]@users.noreply.github.com - auto_fix: false - stylelint: true - eslint: true - eslint_extensions: js,ts,vue - prettier: true - prettier_extensions: js,ts,vue - neutral_check_on_warning: true + run: npm run lint + - name: Run build 🏁 - run: npm run generate + run: npm run build diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 00000000..e0afc9fa --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,31 @@ +name: 'The Pipeline' + +on: + push: + branches: + - main + - dev + pull_request: + branches: + - main + - dev + +concurrency: + group: ci-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + extract-branch: + name: 'Fetch branch' + runs-on: ubuntu-latest + outputs: + current_branch: ${{ steps.get-branch.outputs.current_branch }} + steps: + - name: Extract branch name 🕊 + id: get-branch + run: echo "current_branch=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT + ci: + needs: + - extract-branch + name: 'CI' + uses: ./.github/workflows/ci.yml diff --git a/.github/workflows/shipjs-trigger.yml b/.github/workflows/shipjs-trigger.yml index f2612f9b..63589758 100644 --- a/.github/workflows/shipjs-trigger.yml +++ b/.github/workflows/shipjs-trigger.yml @@ -5,6 +5,9 @@ on: types: - closed +permissions: + contents: write + jobs: build: name: Release @@ -30,11 +33,11 @@ jobs: cache: 'npm' - name: Install dependencies 🚀 - run: npm ci --prefer-offline --no-audit --omit=optional + run: npm ci --prefer-offline --no-audit - name: Trigger a release 🥳 run: npx shipjs trigger env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} diff --git a/ship.config.cjs b/ship.config.cjs index dcae7b85..81c6b363 100644 --- a/ship.config.cjs +++ b/ship.config.cjs @@ -1,5 +1,5 @@ module.exports = { - installCommand: () => 'npm i --prefer-offline --no-audit --omit=optional', + installCommand: () => 'npm i --prefer-offline --no-audit', buildCommand: () => null, publishCommand: ({ tag }) => `echo "Releasing ${tag} version of Expenses frontend webapp"`,