Failures happen. What to do if a release action fails?
agilecustoms/release consists of several steps with three modify operations at the end:
- Validate
- Release generation
- generate a new version
- generate release notes (write in /tmp file)
- update CHANGELOG.md
- Login in AWS
- Prepare
- update version in
package.json(npm),pom.xml(maven),pyproject.toml(Python) - run a custom script to update arbitrary files
- update version in
- Publish artifacts (currently AWS S3/ECR/CodeArtifact, npm)
- Git push
- commit changes from step 4
- add version tag, move floating tags
- atomically push commit and refs (tags and notes) to the remote repository
- GitHub release
- Print summary
Failure on early steps (1-4) is not critical, just fix the issue and re-run the workflow
Then there are three modify operations and their consequences/remediation in case of failure:
Publish artifacts goes first as it is the most complex (highest chances to fail).
It is idempotent, so if a later step fails, it is safe to re-run "Publish artifacts".
Note: some publish commands are not idempotent (npm publish),
so as workaround they just swallow 'same version already exists' type of errors
if it is not the first workflow run (use ${{ github.run_attempt }})
Git push goes next as it is much simpler and less likely to fail. It is atomic, but not idempotent. If it fails — it is safe to rerun (bcz previous step is idempotent)
GitHub release goes last because it needs a git tag to already exist.
It is also very simple — just one command (actual release notes are generated at step 2).
If it fails, do not re-run the workflow as it may create a new version!
Why may? It depends on your version generation approach.
Best remedy - get release notes from CHANGELOG.md and create missing release manually via GitHub UI