diff --git a/.github/workflows/deploy-production-manual.yml b/.github/workflows/deploy-production-manual.yml deleted file mode 100644 index 6ab9ebaf6bb..00000000000 --- a/.github/workflows/deploy-production-manual.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Deploy production (manual) -on: - workflow_dispatch: -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Run deployment script - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - chmod +x ./src/scripts/deploy.sh - ./src/scripts/deploy.sh production diff --git a/.github/workflows/deploy-production-push.yml b/.github/workflows/deploy-production-push.yml new file mode 100644 index 00000000000..d8cd479123c --- /dev/null +++ b/.github/workflows/deploy-production-push.yml @@ -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} diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 88535e823f3..1de1838c08a 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -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} diff --git a/src/scripts/deploy.sh b/src/scripts/deploy.sh index 7adff6392b3..e0c99927f20 100755 --- a/src/scripts/deploy.sh +++ b/src/scripts/deploy.sh @@ -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 }