build(deps): bump monicahq/workflows from 1 to 2 (#696) #962
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] | |
release: | |
types: [created] | |
workflow_dispatch: | |
env: | |
php-version: '8.2' | |
jobs: | |
############# | |
# Build | |
############# | |
build: | |
uses: monicahq/workflows/.github/workflows/build_assets.yml@v2 | |
with: | |
node-version: 18 | |
store: true | |
###################### | |
# 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.8.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Download assets | |
uses: actions/download-artifact@v4 | |
with: | |
name: assets | |
path: public/build | |
- 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 $GITHUB_SHA | cut -c-8 > 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 }} | |
############################ | |
# Create a release on sentry | |
############################ | |
# sentry: | |
# runs-on: ubuntu-latest | |
# name: Sentry release | |
# needs: deploy | |
# if: github.event_name != 'pull_request' | |
# environment: fortrabbit-sentry | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Create Sentry release | |
# uses: getsentry/action-release@v1 | |
# env: | |
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
# with: | |
# environment: ${{ secrets.SENTRY_ENVIRONMENT }} |