chore(deps-dev): bump sass from 1.71.1 to 1.77.2 #599
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
release: | |
types: [created] | |
workflow_dispatch: | |
env: | |
php-version: '8.2' | |
node-version: 20 | |
jobs: | |
############# | |
# Build | |
############# | |
build: | |
runs-on: ubuntu-latest | |
name: Build assets | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
release: ${{ steps.version.outputs.release }} | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP ${{ env.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.php-version }} | |
extensions: mbstring, dom, fileinfo | |
coverage: none | |
- name: Check PHP Version | |
run: php -v | |
- name: Check Composer Version | |
run: composer -V | |
- name: Check PHP Extensions | |
run: php -m | |
# Composer | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer files | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }} | |
${{ runner.os }}-composer-${{ env.php-version }} | |
${{ runner.os }}-composer- | |
- name: Install composer dependencies | |
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader | |
# Yarn | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node-version }} | |
cache: yarn | |
- name: Install yarn dependencies | |
run: yarn install | |
- name: Lint files | |
run: yarn run lint:fix | |
- name: Check if there is any file update needed | |
id: check | |
run: | | |
status=$(git status --porcelain) | |
if [ -z "$status" ]; then | |
echo "Nothing to push, already up to date." | |
else | |
echo -e "Waiting modifications:\n$status" | |
echo "::error::Resources are not up to date. Please rebuild with: 'yarn run lint:all' and 'yarn run prod'." | |
exit -1 | |
fi | |
- name: Get version | |
id: version | |
run: | | |
echo "version=$(git describe --abbrev=0 --tags | sed 's/^v//')" >> $GITHUB_OUTPUT | |
echo "release=$(git describe --abbrev=0 --tags --exact-match $GITHUB_SHA 2>/dev/null || git log --pretty="%h" -n1 $GITHUB_SHA)" >> $GITHUB_OUTPUT | |
- name: Build assets | |
run: yarn run production | |
- name: Store assets | |
uses: actions/upload-artifact@v4 | |
with: | |
name: assets | |
path: | | |
public/mix-manifest.json | |
public/js | |
public/css | |
public/fonts | |
- name: Store source maps | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sourcemaps | |
path: | | |
public/**/*.map | |
###################### | |
# Deploy on fortrabbit | |
###################### | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy | |
needs: build | |
if: github.event_name != 'pull_request' | |
environment: fortrabbit | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Download assets | |
uses: actions/download-artifact@v4 | |
with: | |
name: assets | |
path: public | |
- name: Configure Git | |
run: | | |
git config user.email $GIT_EMAIL | |
git config user.name $GIT_USERNAME | |
env: | |
GIT_EMAIL: ${{ secrets.GIT_EMAIL }} | |
GIT_USERNAME: ${{ secrets.GIT_USERNAME }} | |
- name: Create release files | |
run: | | |
echo ${{ needs.build.outputs.version }} > config/version | |
echo ${{ needs.build.outputs.release }} > config/release | |
echo $GITHUB_SHA > config/commit | |
- name: Update .htaccess | |
run: cp -f resources/.htaccess_production public/.htaccess | |
- name: Commit everything | |
run: | | |
git add -A --force public config | |
git commit -m "Build $($CURRENT_DATE_TIME)" | |
env: | |
CURRENT_DATE_TIME: "date +%Y-%m-%d:%H-%M" | |
- name: Deploy | |
run: | | |
git remote add deploy $REPO_URL | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
git push deploy $branch:master --force | |
env: | |
# This avoids a failure when the client does not know the SSH Host already | |
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | |
REPO_URL: ${{ secrets.REPO_URL }} |