This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
Merge pull request #38 from kthcloud/pierrelefevre-patch-1 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate build branch | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
generate-build-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate build branch | |
run: | | |
git config --global user.name "kthcloud" | |
git config --global user.email "noreply@cloud.cbh.kth.se" | |
git config --global credential.helper cache | |
echo "Generating types and docs" | |
cd scripts | |
source ./path-cmd.sh | |
chmod +x ./generate-types.sh | |
./generate-types.sh | |
chmod +x ./generate-docs.sh | |
./generate-docs.sh | |
cd .. | |
echo "Cloning build branch" | |
cd .. | |
git clone https://${{secrets.GH_ACCESS_TOKEN}}@github.com/kthcloud/sys-api -b build build | |
cd build | |
npm_package_version=$(cat export/package.json | jq -r '.version') | |
if [ -z "$npm_package_version" ]; then | |
npm_package_version="1.0.0" | |
fi | |
cd ../sys-api | |
echo "Found package version $npm_package_version" | |
sed -i "s/\"version\": \".*\"/\"version\": \"$npm_package_version\"/g" export/package.json | |
echo "Cleaning up build branch" | |
rm -rf ../build/* | |
cp -r ./* ../build | |
echo "Copying into build branch" | |
rm -rf ../build/.github | |
cp -r ./.github ../build | |
cd ../build | |
git add . | |
if ! git diff-index --quiet HEAD; then | |
echo "Committing changes" | |
git commit -m "[🚚 CI] Generate build from main" | |
git push | |
else | |
echo "No changes to commit" | |
fi |