Skip to content

Commit

Permalink
Add new workflow script
Browse files Browse the repository at this point in the history
  • Loading branch information
Crustan committed Sep 23, 2024
1 parent 76ed464 commit c892c65
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,37 @@ name: Copy source code and minify to GitHub Pages branch
on:
push:
branches:
- source
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update-main:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: Checkout main
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config user.name 'github-actions'
git config user.email 'github-actions@github.com'
- name: Merge source into main
run: |
git checkout main
git merge source --no-ff
- name: Minify HTML
uses: docker://textadi/minifier-compressor-html-action:v2
env:
DIR: .
PARAM_MINIFY_CSS: True
PARAM_MINIFY_JS: True
- name: Commit and push to main

- name: Commit minified files to build branch
run: |
git checkout -b build || git checkout build
git add .
git commit -m "Update main from source and minify HTML"
git push origin main
git commit -m "Minify HTML"
git push origin build -f
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c892c65

Please sign in to comment.