Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: seperate job runs #393

Merged
merged 6 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
workflow_dispatch:
workflow_call:

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-pnpm-setup
- uses: ./.github/actions/setup-env
with:
env_vars: ${{ secrets.ENV_VARS }}
ga_id: ${{ secrets.GA_ID }}
- uses: ./.github/actions/pnpm-install
- name: build
run: pnpm build
168 changes: 0 additions & 168 deletions .github/workflows/ci.yaml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI

on:
push:
branches:
- main

pull_request:
types:
- opened
- synchronize

permissions:
contents: write
issues: write
pull-requests: write

concurrency:
group: Release
cancel-in-progress: false

jobs:
validate-pr:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/validate-pr.yml
secrets: inherit

format:
uses: ./.github/workflows/format.yml
secrets: inherit

lint:
uses: ./.github/workflows/lint.yml
secrets: inherit

test:
uses: ./.github/workflows/test.yml
secrets: inherit

secrets-leaks:
uses: ./.github/workflows/secrets-leaks.yml
secrets: inherit

build:
uses: ./.github/workflows/build.yml
secrets: inherit

mergeable:
if: always()
needs:
- format
- lint
- test
- secrets-leaks
- build
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
id: all-green
with:
jobs: ${{ toJSON(needs) }}

# preview-deployemnt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/node-pnpm-setup
# - uses: ./.github/actions/setup-env
# with:
# env_vars: ${{ secrets.ENV_VARS }}
# ga_id: ${{ secrets.GA_ID }}
# - name: Install Vercel CLI
# run: npm install --global vercel@latest
# - name: Pull Vercel Environment Information
# run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
# - name: Build Project Artifacts
# run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
# - name: Deploy Project Artifacts to Vercel
# run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

container-registry:
if: github.ref == 'refs/heads/main'
needs:
- mergeable
uses: ./.github/workflows/container-registry.yml
secrets: inherit
26 changes: 26 additions & 0 deletions .github/workflows/container-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
workflow_dispatch:
workflow_call:

jobs:
push-container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-pnpm-setup
- uses: ./.github/actions/setup-env
with:
env_vars: ${{ secrets.ENV_VARS }}
ga_id: ${{ secrets.GA_ID }}
- name: Version extraction
id: get_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
- name: Building & tagging
run: |
docker build -t ashgw/mysite:latest -f deployment/dockerfile . && docker build -t ashgw/mysite:${{ steps.get_version.outputs.version }} -f deployment/dockerfile .
- name: Login
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ashgw --password-stdin
- name: Pushing to the hub both versions
run: docker push ashgw/mysite:latest && docker push ashgw/mysite:${{ steps.get_version.outputs.version }}
19 changes: 19 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
workflow_dispatch:
workflow_call:

jobs:
format:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-pnpm-setup
- uses: ./.github/actions/setup-env
with:
env_vars: ${{ secrets.ENV_VARS }}
ga_id: ${{ secrets.GA_ID }}
- uses: ./.github/actions/pnpm-install
- name: format
run: pnpm format
9 changes: 3 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Lint
name: CI

on:
workflow_dispatch:
workflow_call:

permissions:
actions: write
contents: read

jobs:
lint:
runs-on: ubuntu-20.04
Expand All @@ -19,4 +16,4 @@ jobs:
ga_id: ${{ secrets.GA_ID }}
- uses: ./.github/actions/pnpm-install
- name: lint
run: echo 'pnpm lint' # TODO: actually fix this shit ISID: #335
run: pnpm lint
16 changes: 16 additions & 0 deletions .github/workflows/secrets-leaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
workflow_dispatch:
workflow_call:

jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading