Skip to content

Decidim auto update #12191

Decidim auto update

Decidim auto update #12191

Workflow file for this run

name: "Decidim auto update"
on:
schedule:
- cron: "*/15 3-19 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
RUBY_VERSION: 3.3.4
NODE_VERSION: 18.17.1
REDIS_URL:
jobs:
check:
name: Check for changes
runs-on: ubuntu-latest
outputs:
continue: ${{ steps.check-sha.outputs.has_changes }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Check SHA
id: check-sha
run: |
LOCAL_DECIDIM_SHA=$(grep revision Gemfile.lock | awk '{print $2}')
REMOTE_DECIDIM_SHA=$(git ls-remote https://github.com/decidim/decidim.git | grep feature/redesign-staging | awk '{print $1}')
echo "Local hash: ${LOCAL_DECIDIM_SHA}";
echo "Remote hash: ${REMOTE_DECIDIM_SHA}";
if [[ "${LOCAL_DECIDIM_SHA}" == "${REMOTE_DECIDIM_SHA}" ]]; then
echo "Local and remote Decidim SHA match. Aborting.";
echo "has_changes=false" >> "$GITHUB_OUTPUT";
else
echo "has_changes=true" >> "$GITHUB_OUTPUT";
fi
main:
name: Update code
# Disable check temporally
# needs: [check]
# if: needs.check.outputs.continue == 'true'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "dir=$(npm get cache)-decidim-populate-redesign" >> $GITHUB_OUTPUT;
shell: "bash"
- uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-
- run: ./bin/decidim_auto_update.sh
name: Run decidim auto update
shell: "bash"
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
author_email: "[email protected]"
message: "Update decidim"
- name: Push to dokku
uses: dokku/github-action@master
with:
# specify the `main` branch as the remote branch to push to
branch: 'main'
git_remote_url: 'ssh://[email protected]/~/decidim-lot2'
ssh_private_key: ${{ secrets.DOKKU_DEPLOY_SSH_KEY }}
git_push_flags: '--force -vvv'
trace: 1