Skip to content

Commit

Permalink
Merge pull request #2851 from AlchemyCMS/commit-js-after-build
Browse files Browse the repository at this point in the history
CI: Commit changes to javascript bundles
  • Loading branch information
tvdeyen authored Apr 26, 2024
2 parents fdc7249 + 7a46e57 commit ec89ec4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
41 changes: 40 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ jobs:
run: yarn install
- name: YARN build
run: yarn build
- uses: actions/upload-artifact@v4
with:
name: javascript-files-${{ github.ref_name }}
path: vendor/javascript

RSpec:
needs: [check_yarn_lock, build_javascript]
if: ${{ success('check_yarn_lock') && !failure('build_javascript')}}
if: ${{ success('check_yarn_lock') && !failure('build_javascript') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -135,6 +139,11 @@ jobs:
sudo apt update -qq
sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
sudo chown -R runner /home/runner/apt/cache
- uses: actions/download-artifact@v4
if: needs.check_yarn_lock.outputs.yarn_lock_changed == 'true'
with:
name: javascript-files-${{ github.ref_name }}
path: vendor/javascript
- name: Prepare database
run: |
bundle exec rake alchemy:spec:prepare
Expand All @@ -153,6 +162,36 @@ jobs:
name: Screenshots
path: spec/dummy/tmp/screenshots

PushJavascript:
runs-on: ubuntu-latest
needs: [check_yarn_lock, RSpec]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of our personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- uses: actions/download-artifact@v4
if: needs.check_yarn_lock.outputs.yarn_lock_changed == 'true'
with:
name: javascript-files-${{ github.ref_name }}
path: vendor/javascript
- name: Check git status
id: git-status
run: git diff --quiet vendor/javascript || echo "changed=true" >> $GITHUB_OUTPUT
- name: git commit
if: steps.git-status.outputs.changed == 'true'
run: |
git config --local user.name 'AlchemyCMS - CI Bot'
git config --local user.email 'alchemy@blish.cloud'
git add vendor/javascript
git commit -m "Update JS packages" -m "Rebuilt packages after updating dependencies." --trailer "skip-checks: true"
- name: Push changes
if: steps.git-status.outputs.changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ALCHEMY_CI_BOT_ACCESS_TOKEN }}
branch: ${{ github.ref }}

Jest:
runs-on: ubuntu-latest
env:
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/picture_library_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
within "#flash_notices" do
expect(page).to have_content("Picture updated successfully")
end
expect(picture.description_for(language)).to eq("This is an amazing image.")
expect(picture.reload.description_for(language)).to eq("This is an amazing image.")
end

scenario "allows to add multi language picture descriptions", :js do
Expand All @@ -90,7 +90,7 @@
within "#flash_notices" do
expect(page).to have_content("Picture updated successfully")
end
expect(picture.description_for(german)).to eq("Tolles Bild.")
expect(picture.reload.description_for(german)).to eq("Tolles Bild.")
end
end
end

0 comments on commit ec89ec4

Please sign in to comment.