-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add checks and debug for sem-release
- add one more debug message - ensure the NEXT_VERSION is not empty before proceeding to release This contribution is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification).
- Loading branch information
1 parent
6f78194
commit b1e04a0
Showing
1 changed file
with
26 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
name: Release CI | ||
on: | ||
push: | ||
branches: # Create a GitHub release from `main` | ||
- main | ||
pull_request: # Test the workflow without creating a release | ||
branches: | ||
- main | ||
|
||
|
@@ -13,21 +16,36 @@ jobs: | |
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: semantic release | ||
|
||
- name: Prepare semantic release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} | ||
run: | | ||
# Run in dry-run mode to determine the next tag version and store it in semantic-release-next-version.txt | ||
npx [email protected] --dry-run | tee semantic-release-dry-run-output.txt | ||
cat semantic-release-dry-run-output.txt \ | ||
| grep -o 'Skip v.* tag creation in dry-run mode' \ | ||
| sed -e 's/^Skip //' | sed -e 's/ tag creation in dry-run mode$//' \ | ||
| tee semantic-release-next-version.txt | ||
npx [email protected] --dry-run | tee semantic-release-next-version.txt | ||
NEXT_VERSION=$( | ||
cat semantic-release-next-version.txt | \ | ||
grep -o 'Skip v.* tag creation in dry-run mode' \ | ||
| sed -e 's/^Skip //' | sed -e 's/ tag creation in dry-run mode$//' | ||
) | ||
echo "DEBUG: Next version is '$NEXT_VERSION'" # Debug version number | ||
echo "DEBUG: Next version is '$(cat semantic-release-next-version.txt)'" # Debug version number | ||
if [ -z "$NEXT_VERSION" ]; then | ||
echo "ERROR: Could not determine next version from semantic-release dry-run output." | ||
exit 1 | ||
fi | ||
# Hardcode the next tag version in the atlas script | ||
sed -i -e "s/_ATLAS_VERSION=.*/_ATLAS_VERSION=\"$(cat semantic-release-next-version.txt)\" # Tagged by release.yml/" atlas | ||
sed -i -e "s/_ATLAS_VERSION=.*/_ATLAS_VERSION=\"$NEXT_VERSION\" # Tagged by release.yml/" atlas | ||
echo "DEBUG: 'atlas --version' output is '$(./atlas --version)'" # Debug version number | ||
- name: Semantic release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
# Actually create the tag and upload the atlas script | ||
npx [email protected] |