Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ jobs:
echo "::error::$TAG is not a $CHAIN release tag; expected $CHAIN-release-<spec>"
exit 1
fi
echo "chain=$CHAIN" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "ref=${TAG:-$GITHUB_REF}" >> "$GITHUB_OUTPUT"
# Fully qualified: checkout prefers a branch over a tag of the same name.
REF="$GITHUB_REF"
if [ -n "$TAG" ]; then REF="refs/tags/$TAG"; fi
{
echo "chain=$CHAIN"
echo "tag=$TAG"
echo "ref=$REF"
} >> "$GITHUB_OUTPUT"

- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
Expand All @@ -100,8 +105,13 @@ jobs:
run: |
SHA="$(git rev-parse HEAD)"
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
if [ -n "$TAG" ] && [ "$SHA" != "$(git rev-parse "refs/tags/$TAG^{commit}")" ]; then
echo "::error::checked out $SHA, which is not the commit $TAG points at"
exit 1
fi
# Releases are published only for commits on main; a dry run may build any ref.
if [ -n "$TAG" ] && ! git merge-base --is-ancestor "$SHA" origin/main; then
# Fully qualified, so a tag named origin/main cannot stand in for the branch.
if [ -n "$TAG" ] && ! git merge-base --is-ancestor "$SHA" refs/remotes/origin/main; then
echo "::error::$TAG points at $SHA, which is not on main; refusing to publish a release for it"
exit 1
fi
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/version-up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,26 @@ jobs:
contents: write
pull-requests: write
steps:
# Install cargo-edit if specific version is NOT provided. Pinned and
# locked so every run builds the same dependency tree, and installed
# before the checkout so its build runs with no repository on disk.
- name: install cargo-edit
if: github.event.inputs.specific_version == ''
run: |
cargo install cargo-edit --locked --version 0.13.13

- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
fetch-depth: 0
# The token goes only to the steps that write to the repository.
persist-credentials: false

- name: Setup User
run: |
git config user.name github-actions
git config user.email github-actions@github.com

# Install cargo-edit if specific version is NOT provided
- name: install cargo-edit
if: github.event.inputs.specific_version == ''
run: |
cargo install cargo-edit

- name: Check For Specific Version
if: github.event.inputs.specific_version != ''
env:
Expand Down Expand Up @@ -107,6 +111,7 @@ jobs:
- name: Create Release Branch
id: new-branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PKG: ${{ steps.set-pkg.outputs.name }}
DAY: ${{ steps.date-now.outputs.day }}
MONTH: ${{ steps.date-now.outputs.month }}
Expand All @@ -129,7 +134,7 @@ jobs:
echo "name=${branch_name}" >> "$GITHUB_OUTPUT"

git checkout -b "${branch_name}"
git push --set-upstream origin "${branch_name}"
gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/heads/${branch_name}" -f sha="$(git rev-parse HEAD)" --silent

# todo: make this simpler.
- name: Commit New Changes to New Branch (all)
Expand Down
Loading