Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt release workflow for workspace #331

Merged
merged 5 commits into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion .github/scripts/extract-tag-from-release-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
set -euxo pipefail

message="$(head -n1 <<< "$COMMIT_MESSAGE")"
version="$(cut -d ' ' -f 2 <<< "${message}")"
crate="$(cut -d ' ' -f 2 <<< "${message}")"
version="$(cut -d ' ' -f 3 <<< "${message}")"
echo "::set-output name=crate::${crate}"
echo "::set-output name=version::${version}"
2 changes: 1 addition & 1 deletion .github/scripts/release-pr-template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You will still need to manually publish the cargo crate:
```
$ git pull
$ git switch --detach v{version}
$ cargo publish
$ cargo publish -p <%= crate.name %>
```

<% if (pr.releaseNotes) { %>
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ inputs.version }}
crate-path: crates/${{ inputs.crate }}
pr-release-notes: true
pr-release-notes: ${{ inputs.crate == 'cli' }}
passcod marked this conversation as resolved.
Show resolved Hide resolved
pr-template-file: .github/scripts/release-pr-template.ejs
17 changes: 14 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ on:
jobs:
info:
runs-on: ubuntu-latest
# the commit message will look like: `release: v{version} (#{pr-number})`
if: "startsWith(github.event.head_commit.message, 'release: v')"
# the commit message will look like: `release: {crate-name} v{version} (#{pr-number})`
if: "startsWith(github.event.head_commit.message, 'release: ')"
NobodyXu marked this conversation as resolved.
Show resolved Hide resolved
outputs:
crate: ${{ steps.version.outputs.crate }}
version: ${{ steps.version.outputs.version }}
notes: ${{ fromJSON(steps.notes.outputs.notes_json) }}
env:
Expand All @@ -33,20 +34,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Push release tag
- name: Push lib release tag
if: "! startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
NobodyXu marked this conversation as resolved.
Show resolved Hide resolved
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.info.outputs.version }}
tag_prefix: ${{ needs.info.outputs.crate }}-
- name: Push cli release tag
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.info.outputs.version }}
tag_prefix: ''

build:
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
needs: info # not really, but just so it fails fast
uses: ./.github/workflows/build.yml
with:
for_release: true

release:
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
needs:
- info
- tag
Expand Down