Refactor build workflow and add branch validation

This commit is contained in:
mr. M
2024-10-11 18:30:32 +02:00
parent a01a6d0f43
commit 69020cc516
5 changed files with 84 additions and 16 deletions

View File

@@ -54,12 +54,52 @@ jobs:
echo "GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}"
echo "GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
check-build-is-correct:
runs-on: ubuntu-latest
needs: [debug-inputs]
steps:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.DEPLOY_KEY }}
- name: Check if correct branch
run: |
echo "Checking if we are on the correct branch"
git branch
git status
git branch --show-current
if [[ $(git branch --show-current) != ${{ inputs.update_branch }} ]]; then
echo ">>> Branch mismatch"
exit 1
else
echo ">>> Branch matches"
fi
- name: Check if branch is up to date
run: |
echo "Checking if branch is up to date"
git fetch
git pull
git status
if [[ $(git status) == *"Your branch is up to date with"* ]]; then
echo ">>> Branch is up to date"
else
echo ">>> Branch is not up to date"
exit 1
fi
build-data:
permissions:
contents: write
name: Generate build data
runs-on: ubuntu-latest
needs: debug-inputs
needs: check-build-is-correct
outputs:
build_date: ${{ steps.data.outputs.builddate }}
version: ${{ steps.data.outputs.version }}