diff --git a/.github/workflows/ci-cd.yml.txt b/.github/workflows/ci-cd.yml.txt new file mode 100644 index 0000000..4372fc8 --- /dev/null +++ b/.github/workflows/ci-cd.yml.txt @@ -0,0 +1,87 @@ +name: CI/CD Pipeline + +on: + pull_request: + branches: [ main ] + types: [ opened, synchronize ] + +permissions: + contents: write + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install dependencies + run: npm install + - name: Run linter + run: npm run lint + # If you haven't set up ESLint yet, see https://eslint.org/docs/latest/user-guide/getting-started + + security-scan: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install dependencies + run: npm install + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: javascript + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test + +build: + needs: [lint, security-scan, test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: { node-version: 16 } + - run: npm install + - run: npm run build + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + +release: + needs: build + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # provided automatically by GitHub + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v4 + with: { name: dist } + - id: create_release + uses: elgohr/Github-Release-Action@v5 + with: + title: Dev Build ${{ github.sha }} + tag: dev-${{ github.sha }} + prerelease: true diff --git a/.github/workflows/ci1.yml.txt b/.github/workflows/ci1.yml.txt new file mode 100644 index 0000000..6dbafaf --- /dev/null +++ b/.github/workflows/ci1.yml.txt @@ -0,0 +1,25 @@ +name: GitHub Actions Build and Deploy Demo +on: + push: + branches: + - master +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Checkout + uses: actions/checkout@v4 + - name: Install and Build + run: | + npm install + npm run-script build + - name: Deploy + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: gh-pages + FOLDER: build diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml new file mode 100644 index 0000000..5684c2b --- /dev/null +++ b/.github/workflows/upstream.yml @@ -0,0 +1,42 @@ +name: upstream + +on: + workflow_dispatch: + schedule: + - cron: "33 3 * * 3" # weekly + +permissions: + contents: read + issues: write # to create issues if the upstream check fails + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: ['latest'] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run upstream + - name: Handle error + if: ${{ failure() }} + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const { owner, repo } = context.repo; + const nodeVersion = process.version; + const issueTitle = `Upstream check failed`; + const issueBody = `Node ${nodeVersion} has made changes to the functions this module depends on. Please review the new function changes, determine if this module requires changes because of them, and update the function hashes. Add a comment below with your findings.`; + + const issue = await github.rest.issues.create({ + owner, + repo, + title: issueTitle, + body: issueBody, + }); diff --git a/README.md b/README.md index 320564c..12577a8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +>![CI Pipeline Badge](https://github.com/your-user/your-repo/actions/workflows/ci-cd.yml/badge.svg) + # Tailwind CSS for Rails [Tailwind CSS](https://tailwindcss.com) is a utility-first CSS framework packed with classes like `flex`, `pt-4`, `text-center` and `rotate-90` that can be composed to build any design, directly in your markup. @@ -104,7 +106,7 @@ gem "tailwindcss-ruby", "~> 3.4" # only necessary with tailwindcss-rails <= 3.3. First, update to `tailwindcss-rails` v4.0.0 or higher. This will also ensure you're transitively depending on `tailwindcss-ruby` v4. ```ruby -# Gemfile +# Gemfile gem "tailwindcss-rails", "~> 4.0" # which transitively pins tailwindcss-ruby to v4 ```