From ce1de1fd8abe5bc501ffa73593dfd0856add46c5 Mon Sep 17 00:00:00 2001 From: ctw-joao-luis Date: Wed, 9 Oct 2024 16:17:41 +0100 Subject: [PATCH] adding script to pipeline to automatically bump version (#2) --- .github/workflows/bump-version.yml | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/bump-version.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 00000000..e49de7b6 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,56 @@ +name: Auto Bump Version + +on: + push: + branches: + - main # Trigger on push to main branch + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.LICHTBLICK_GITHUB_TOKEN }} + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - run: corepack enable + + - name: Cache yarn dependencies + uses: actions/cache@v4 + with: + path: | + **/node_modules + ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --mode skip-build + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: false + + - name: Set up Git + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + + - name: Bump version in root package.json + run: yarn version --new-version patch --no-git-tag-version + + - name: Commit version bumps + id: commit_version_bumps + run: | + git add package.json yarn.lock + git commit -m "chore: bump versions in root package.json [skip actions]" + echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Push changes + run: | + git push origin main