Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deploy workflows #2013

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading