Skip to content

Commit

Permalink
Replace stash/reset with the expectation that there are no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JensDallmann committed Sep 10, 2021
1 parent ca29932 commit 20ec7ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/feature-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ jobs:
- name: Set prerelease version (if triggered manually)
if: github.event_name == 'workflow_dispatch'
run: |
git stash
if [ -n "$(git status --porcelain)" ]; then
git status
echo "error:: There are unexpected changes in git!";
exit 1
fi
actual_version=$(cat .release-version)
prnumber=${{ steps.read-prnumber.outputs.prnumber }}
next_version=$(semver --increment prerelease --preid pr${prnumber}-${{ github.run_number }} ${actual_version})
pnpm run setversion -- ${next_version} --filter=coremedia/* --dependencyVersion=${next_version}
pnpm install --no-frozen-lockfile
git commit -am "Set PR Version: ${next_version}"
git stash apply
- name: Build
run: pnpm build
- name: Lint
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ jobs:
- name: Create Release Version
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
run: |
git stash
if [ -n "$(git status --porcelain)" ]; then
git status
echo "error:: There are unexpected changes in git!";
exit 1
fi
actual_version=$(cat .release-version)
next_version=$(semver --increment ${{ github.event.inputs.release_type }} ${actual_version})
pnpm run setversion -- ${next_version} --filter=coremedia/* --dependencyVersion=^${next_version}
pnpm install --no-frozen-lockfile
echo "${next_version}" > .release-version
git commit -am "Set release version ${next_version}"
git stash apply
#Provide the actual version for later checks.
#Access: steps.read-version.outputs.version
- name: Read Version
Expand Down Expand Up @@ -96,7 +99,11 @@ jobs:
# Make sure to not commit anything which has been changed in one of the previous steps.
# Update the version, afterwards commit and push.
run: |
git reset --hard
if [ -n "$(git status --porcelain)" ]; then
git status
echo "error:: There are unexpected changes in git!";
exit 1
fi
actual_version=$(cat .release-version)
next_version=$(semver --increment prerelease --preid rc ${actual_version})
pnpm run setversion -- ${next_version} --filter=coremedia/* --dependencyVersion=${next_version}
Expand Down

0 comments on commit 20ec7ce

Please sign in to comment.