-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* copy release process from spec * update changelog * update Cargo.toml version when releasing * build cli on release
- Loading branch information
1 parent
34a1ee2
commit dae910a
Showing
9 changed files
with
253 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Deploy | ||
run-name: ${{ github.event_name == 'release' && github.ref_name || inputs.version }} | ||
|
||
concurrency: | ||
cancel-in-progress: false | ||
group: '${{ github.workflow }}' | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
- edited | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: The version (the release name) to deploy | ||
type: string | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
setup: | ||
name: Setup references | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ref: ${{ steps.ref.outputs.ref }} | ||
steps: | ||
- name: Trigger on release | ||
if: ${{ github.event_name == 'release' }} | ||
run: echo "REF=${{ github.ref_name }}" >> "$GITHUB_ENV" | ||
- name: Trigger on manual dispatch | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: echo "REF=${{ inputs.version }}" >> "$GITHUB_ENV" | ||
- name: Set reference | ||
id: ref | ||
run: echo "ref=$REF" >> "$GITHUB_OUTPUT" | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Rust | ||
run: | | ||
rustup set profile minimal | ||
rustup toolchain install stable | ||
rustup default stable | ||
- name: Build cli | ||
run: cargo build --release | ||
- name: Attach to release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
run: gh release upload ${{needs.setup.outputs.ref}} ./target/release/powerd6_tools --clobber |
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
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 |
---|---|---|
@@ -0,0 +1,158 @@ | ||
name: Release | ||
run-name: ${{inputs.release_type}} | ||
|
||
concurrency: | ||
cancel-in-progress: false | ||
group: '${{ github.workflow }}' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_type: | ||
description: "Which type of release is this?" | ||
type: choice | ||
options: | ||
- "patch" | ||
- "minor" | ||
- "major" | ||
default: "patch" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
prepare: | ||
name: Prepare release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
current: ${{ steps.current.outputs.version }} | ||
next: ${{ steps.next.outputs.version }} | ||
branch: ${{ steps.branch.outputs.branch }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GH_ADMIN_TOKEN }} | ||
- name: Configure git | ||
run: |- | ||
gh api /user > user.json | ||
git config --global user.email "$(jq -r '.email' user.json)" | ||
git config --global user.name "$(jq -r '.name' user.json)" | ||
- name: Prepare branch name | ||
id: branch | ||
run: echo "branch=release${{ github.run_id }}" >> "$GITHUB_OUTPUT" | ||
- name: Create branch | ||
run: git checkout -b "${{ steps.branch.outputs.branch }}" | ||
- name: Install semver-cli | ||
run: |- | ||
go install github.com/maykonlf/semver-cli/cmd/semver@latest | ||
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | ||
- name: Get current version | ||
id: current | ||
run: echo "version=$(semver get release)" >> "$GITHUB_OUTPUT" | ||
- name: Get next version | ||
id: next | ||
env: | ||
FLAG: ${{ inputs.release_type == 'patch' && 'release' || inputs.release_type}} | ||
run: |- | ||
semver up "$FLAG" | ||
echo "version=$(semver get release)" >> "$GITHUB_OUTPUT" | ||
git add .semver.yaml | ||
git commit -m "update .semver.yaml" | ||
- name: Prepare environment variables | ||
run: |- | ||
{ | ||
echo "CURRENT=${{steps.current.outputs.version}}" | ||
echo "NEXT=${{steps.next.outputs.version}}" | ||
echo "CURRENT_CARGO=$(echo '${{ steps.current.outputs.version }}' | sed 's/v//')" | ||
echo "NEXT_CARGO=$(echo '${{steps.next.outputs.version}}' | sed 's/v//')" | ||
} >> "$GITHUB_ENV" | ||
- name: update Cargo.toml | ||
run: |- | ||
sed -i "s/$CURRENT_CARGO/$NEXT_CARGO/g" Cargo.toml | ||
git add Cargo.toml | ||
git commit -m "update Cargo.toml" | ||
- name: update CHANGELOG.md | ||
run: |- | ||
head -n 13 CHANGELOG.md > changelog.md.0 | ||
tail -n +15 CHANGELOG.md > changelog.md.1 | ||
# Reset the file | ||
echo -n > CHANGELOG.md | ||
{ | ||
cat changelog.md.0 | ||
echo "## [Unreleased](https://github.com/powerd6/spec/compare/$NEXT...HEAD)" | ||
echo "" | ||
echo "## [$NEXT](https://github.com/powerd6/spec/releases/tag/$NEXT)" | ||
cat changelog.md.1 | ||
} >> CHANGELOG.md | ||
rm changelog.md.* | ||
git add CHANGELOG.md | ||
git commit -m "update CHANGELOG.md" | ||
- name: Push changes | ||
run: git push -u origin "${{ steps.branch.outputs.branch }}" | ||
pr: | ||
name: Create Pull Request | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
outputs: | ||
pr: ${{ steps.pr.outputs.link }} | ||
env: | ||
NEXT: ${{needs.prepare.outputs.next}} | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{needs.prepare.outputs.branch}} | ||
- name: Create Pull Request | ||
id: pr | ||
run: |- | ||
PR_URL=$(gh pr create --title "chore: prepare release for $NEXT" --body "") | ||
echo "link=$PR_URL" >> "$GITHUB_OUTPUT" | ||
- name: Document | ||
run: |- | ||
echo "[PR link](${{ steps.pr.outputs.link }})" >> "$GITHUB_STEP_SUMMARY" | ||
merge: | ||
name: Merge Pull Request | ||
runs-on: ubuntu-latest | ||
needs: pr | ||
env: | ||
PR_URL: ${{needs.pr.outputs.pr}} | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Merge PR | ||
run: gh pr merge "$PR_URL" --admin --squash | ||
draft: | ||
name: Draft release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
- merge | ||
outputs: | ||
release: ${{ steps.release.outputs.link }} | ||
env: | ||
NEXT: ${{needs.prepare.outputs.next}} | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Create Release | ||
id: release | ||
run: |- | ||
RELEASE_URL=$(gh release create "$NEXT" \ | ||
--target main \ | ||
--title "$NEXT" \ | ||
--generate-notes \ | ||
--latest \ | ||
--draft) | ||
echo "link=$RELEASE_URL" >> "$GITHUB_OUTPUT" | ||
- name: Document | ||
run: |- | ||
echo "[Release link](${{ steps.release.outputs.link }})" >> "$GITHUB_STEP_SUMMARY" | ||
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
alpha: 0 | ||
beta: 0 | ||
rc: 0 | ||
release: v0.0.0 |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,3 +1,3 @@ | ||
# powerd6/tools | ||
|
||
A collection of tools to work with powerd6 artifacts. | ||
A collection of tools to work with powerd6 artifacts. |