diff --git a/.github/compile-latest.yml b/.github/workflows/compile-latest.yml similarity index 72% rename from .github/compile-latest.yml rename to .github/workflows/compile-latest.yml index 53b2784..4db0079 100644 --- a/.github/compile-latest.yml +++ b/.github/workflows/compile-latest.yml @@ -28,21 +28,21 @@ jobs: - name: Build project run: npm run build - - name: Configure Git + - name: Commit changes run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - - - name: Commit changes - id: commit-changes - run: | + git status git add dist/ git diff --quiet && git diff --staged --quiet || git commit -m "Update dist with compiled changes" - echo "::set-output name=CHANGES::$(git rev-parse HEAD)" + if [ $? -eq 0 ]; then echo "CHANGES=true" >> $GITHUB_ENV; fi - name: Push changes - if: steps.commit-changes.outputs.CHANGES - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + if: env.CHANGES == 'true' + run: | + git status + echo "there are changes" + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 53b2784..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: 🏗️ Compile latest changes - -on: - # pull_request: - # branches: - # - main - - workflow_dispatch: - - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Ensures history is available for commits - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' - - - name: Install dependencies - run: npm install - - - name: Build project - run: npm run build - - - name: Configure Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Commit changes - id: commit-changes - run: | - git add dist/ - git diff --quiet && git diff --staged --quiet || git commit -m "Update dist with compiled changes" - echo "::set-output name=CHANGES::$(git rev-parse HEAD)" - - - name: Push changes - if: steps.commit-changes.outputs.CHANGES - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }}