diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4a4984f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,53 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + # Trigger the workflow on push or pull request, + push: + branches: [main, stable] + pull_request: + # These types of PRs + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-24.04 + + strategy: + matrix: + node-version: [20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + steps: + - name: "Base requirements" + run: | + # packages + apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible + # ansible collections + ansible-galaxy collection install community.general --force + ansible-galaxy collection install ansible.posix --force + + - uses: actions/checkout@v4 + + # Corepack + - name: Install Corepack + run: npm install -g corepack + - name: "Enable Corepack" + run: corepack enable + - name: "Install Yarn" + run: corepack prepare yarn@latest --activate + + # YARN + - name: "Install Dependencies" + run: yarn install # will run `yarn install` command + #- uses: borales/actions-yarn@v3.0.0 + # with: + # cmd: test # will run `yarn test` command + #- uses: borales/actions-yarn@v3.0.0 + # with: + # cmd: type-check # will run `yarn type-check` command + - name: "Lint Repo" + run: yarn lint # will run `yarn lint` command + - name: "Build Code" + run: yarn run build # will run `yarn build` command diff --git a/.github/workflows/vercel-preview.yaml b/.github/workflows/vercel-preview.yaml new file mode 100644 index 0000000..da6226c --- /dev/null +++ b/.github/workflows/vercel-preview.yaml @@ -0,0 +1,44 @@ +name: Vercel Preview Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + # Trigger the workflow on push or pull request, + # push: + # branches: [main, stable] + pull_request: + # These types of PRs + types: [opened, synchronize, reopened] +jobs: + Deploy-Preview: + runs-on: ubuntu-24.04 + steps: + # Setup environment + - name: "Base requirements" + run: | + # packages + apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible + # ansible collections + ansible-galaxy collection install community.general --force + ansible-galaxy collection install ansible.posix --force + + - uses: actions/checkout@v2 + + # Corepack + - name: Install Corepack + run: npm install -g corepack + - name: "Enable Corepack" + run: corepack enable + - name: "Install Yarn" + run: corepack prepare yarn@latest --activate + + # Vercel + - uses: actions/checkout@v2 + - 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 }} diff --git a/.github/workflows/vercel-production.yaml b/.github/workflows/vercel-production.yaml new file mode 100644 index 0000000..d7801a7 --- /dev/null +++ b/.github/workflows/vercel-production.yaml @@ -0,0 +1,42 @@ +name: Vercel Production Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - main + - stable +jobs: + Deploy-Production: + runs-on: ubuntu-24.04 + + steps: + # Setup environment + - name: "Base requirements" + run: | + # packages + apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible + # ansible collections + ansible-galaxy collection install community.general --force + ansible-galaxy collection install ansible.posix --force + + - uses: actions/checkout@v2 + + # Corepack + - name: Install Corepack + run: npm install -g corepack + - name: "Enable Corepack" + run: corepack enable + - name: "Install Yarn" + run: corepack prepare yarn@latest --activate + + # Vercel + - name: "Install Vercel CLI" + run: npm install --global vercel@latest + - name: "Pull Vercel Environment Information" + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: "Build Project Artifacts" + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: "Deploy Project Artifacts to Vercel" + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}