diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000000..e62677c8cf92 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,45 @@ +name: CI - Build and test +on: + pull_request: + branches: [ "rewrite/main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4.2.2 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1.253.0 + with: + ruby-version: '3.3.5' + bundler-cache: true + + - name: Setup Node.js + uses: actions/setup-node@v4.4.0 + with: + node-version: '22.10.0' + cache: 'npm' + + - name: Install Node.js packages + run: npm ci + + - name: Build stylesheets using Tailwind CSS + run: npm run-script tailwindcss -- --minify + + - name: Build React components using Webpack + env: + MATOMO_URL: mwa-acf.2.rahtiapp.fi + MATOMO_TAG_MANAGER_CONTAINER: jyLY2YKH + run: npm run-script webpack -- --mode=production + + - name: Build site using Jekyll + env: + JEKYLL_ENV: production + run: npm run-script jekyll:build + + - name: Check build artifacts + run: | + ls -la dist/ + echo "Build completed successfully!" diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 52a0f9c1e38b..a285d4404dfd 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -2,8 +2,6 @@ name: Build and deploy site to GitHub Pages on: push: branches: [ "rewrite/main" ] - pull_request: - branches: [ "rewrite/main" ] workflow_dispatch: jobs: @@ -12,17 +10,21 @@ jobs: steps: - uses: actions/checkout@v4.2.2 - with: - ref: rewrite/main - - name: Install Ruby and Node.js using asdf - uses: asdf-vm/actions/install@v3.0.2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1.253.0 + with: + ruby-version: '3.3.5' + bundler-cache: true - - name: Install Ruby gems - run: bundle install + - name: Setup Node.js + uses: actions/setup-node@v4.4.0 + with: + node-version: '22.10.0' + cache: 'npm' - name: Install Node.js packages - run: npm install + run: npm ci # clean install - name: Build stylesheets using Tailwind CSS run: npm run-script tailwindcss -- --minify