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

CI: Commit changes to javascript bundles #2851

Merged
merged 3 commits into from
Apr 26, 2024
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
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