ci: update build-publish workflow for multi-branch and tag support #8
Reference in New Issue
Block a user
Delete Branch "ci/update-workflow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Updates
.github/workflows/build-publish.yamlper issue #7:main,latest, and<sha>tagsv1.0.3): pushes<tag>,latest, and<sha>tagsgitea.ref,gitea.sha,gitea.ref_name,gitea.repository)Image tags produced
mainbranchgit.danhenry.dev/daniel/email-classifier:{main,latest,<sha>}v*.*.*taggit.danhenry.dev/daniel/email-classifier:{<tag>,latest,<sha>}Closes #7
The PR didn't build
9ba8a8b7f9to97abc74297Fixed the if-expression syntax error. The issue was complex nested parentheses and
.startsWith()method calls that Gitea Actions does not support. Resolved by:Restructuring into 3 separate jobs instead of conditional steps within one job:
build-only— runs on all non-main, non-tag pushes (branches, PRs)build-and-push-main— runs only on pushes torefs/heads/mainbuild-and-push-tag— runs only onrefs/tags/v*Replacing
.startsWith()method calls with thestartsWith()function — Gitea Actions supportsstartsWith(gitea.ref, 'refs/tags/v')but notgitea.ref.startsWith(...)Removing complex nested parentheses — the original
github.event_name != 'push' || (...)expression had unmatched/misplaced parens that Gitea Actions could not parse.Workflow should now build. Please re-run the failed action to verify.