Skip to content

Commit

Permalink
Update deploy workflows (#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chalarangelo committed Sep 22, 2023
2 parents 9550376 + 83739fa commit 1d29207
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/deploy-production-manual.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/deploy-production-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy production (push)
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
web:
- 'src/**'
- '.babelrc'
- 'astro.config.mjs'
- 'netlify.toml'
- 'package-lock.json'
- 'package.json'
# run only if 'web' files were changed
- name: Add deployable commit to 'production' branch
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
if: steps.filter.outputs.web == 'true'
run: |
chmod +x ./src/scripts/deploy.sh
./src/scripts/deploy.sh production ${github.event_name}
22 changes: 4 additions & 18 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,15 @@ name: Deploy production
on:
schedule:
- cron: "20 18 * * *"
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
web:
- 'src/**'
- '.babelrc'
- 'astro.config.mjs'
- 'netlify.toml'
- 'package-lock.json'
- 'package.json'
# run only if 'web' files were changed
- name: Run deployment script
- uses: actions/checkout@v1
- name: Add deployable commit to 'production' branch
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
if: steps.filter.outputs.web == 'true'
run: |
chmod +x ./src/scripts/deploy.sh
./src/scripts/deploy.sh production
./src/scripts/deploy.sh production ${github.event_name}
2 changes: 1 addition & 1 deletion src/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ deploy_branch() {
git config --global user.name "30secondsofcode"
git checkout -b $1
git reset --hard origin/master
git commit -m "Deployment - $(date +%Y.%m.%d_%H:%M)" --allow-empty
git commit -m "[$(date +%Y.%m.%d_%H:%M)] Deployment/$2" --allow-empty
git push --force --quiet "https://${GH_TOKEN}@github.com/30-seconds/30-seconds-of-code.git" $1 > /dev/null 2>&1
}

Expand Down

0 comments on commit 1d29207

Please sign in to comment.