Skip to content

Make web and commit #28

Make web and commit

Make web and commit #28

name: Make web and commit
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Debug - List all branches in parent and submodule
run: |
echo "Listing branches in parent repository:"
git branch -a
echo "Listing branches in teddycloud_web submodule:"
cd teddycloud_web
git branch -a
cd ..
- name: Checkout the same branch for teddycloud_web
run: |
# Get the current branch of the parent project
PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Navigate into the submodule directory
cd teddycloud_web
# Fetch all branches from the remote in case it's not already available
git fetch origin
echo "Listing branches in teddycloud_web submodule:"
git branch -a
# Fetch the specific branch from the remote if it doesn't exist locally
if git show-ref --verify --quiet refs/heads/$PARENT_BRANCH; then
git checkout $PARENT_BRANCH
else
# Check if the branch exists on the remote and fetch it
if git ls-remote --heads origin $PARENT_BRANCH | grep -q $PARENT_BRANCH; then
git fetch origin $PARENT_BRANCH:$PARENT_BRANCH
git checkout $PARENT_BRANCH
else
echo "Branch '$PARENT_BRANCH' does not exist in the submodule. Exiting."
exit 1
fi
fi
# Navigate back to the parent directory
cd ..
- name: Git status
run: |
git status
git submodule status
cd teddycloud_web
git status
cd ..
- uses: actions/setup-node@v4
with:
node-version: "20.11.1"
- name: Install NPM version
run: npm install -g [email protected]
- name: Disable CI checks
run: echo "CI=false" >> $GITHUB_ENV
- name: Make Web
run: make web
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "SciLor"
- name: Commit and push if changed
run: |
if [[ -n $(git status --porcelain) ]]; then
git add .
git commit -m "Update frontend (make web)"
git pull --rebase
git push
else
echo "No changes to commit and push."
fi
- name: Get current branch for next step
id: get_branch
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Trigger publish_docker_matrix.yml
uses: actions/github-script@v6
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const event_type = 'trigger-publish-docker'; // Matches the repository_dispatch trigger
const client_payload = { "branch": process.env.branch };
await github.repos.createDispatchEvent({
owner,
repo,
event_type,
client_payload
});
build_docker:
uses: ./.github/workflows/publish_docker_matrix.yml

Check failure on line 114 in .github/workflows/build_commit_web.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build_commit_web.yml

Invalid workflow file

error parsing called workflow ".github/workflows/build_commit_web.yml" -> "./.github/workflows/publish_docker_matrix.yml" (source branch with sha:c6a8da02e50a5e71bb1ba690a79b33f5a47a37b4) --> "./.github/workflows/publish_docker_matrix_debian.yml" (source branch with sha:c6a8da02e50a5e71bb1ba690a79b33f5a47a37b4) : workflow is not reusable as it is missing a `on.workflow_call` trigger