Release #169
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
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
increment: | |
description: Type of version increment. | |
required: true | |
type: choice | |
options: | |
- beta | |
- patch | |
- minor | |
concurrency: | |
group: release | |
cancel-in-progress: false | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Git config | |
run: | | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git config user.name github-actions | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Bump version | |
run: nix develop -c cargo release ${{ inputs.increment }} -x --no-confirm --no-publish --no-push --no-tag | |
- id: version | |
run: | | |
version=$(grep '^version' Cargo.toml | sed 's/version = "//; s/"//') | |
echo "version=$version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Create version branch | |
run: | | |
git push origin --delete release/v${{ steps.version.outputs.version }} || echo "Branch doesn't exist" | |
git checkout -b release/"v${{ steps.version.outputs.version }}" | |
git push origin release/"v${{ steps.version.outputs.version }}" | |
build-nix: | |
needs: version | |
uses: ./.github/workflows/build-nix.yml | |
with: | |
channel: ${{ inputs.increment == 'beta' && 'beta' || 'stable' }} | |
ref: release/v${{ needs.version.outputs.version }} | |
build-windows: | |
needs: version | |
uses: ./.github/workflows/build-windows.yml | |
with: | |
channel: ${{ inputs.increment == 'beta' && 'beta' || 'stable' }} | |
ref: release/v${{ needs.version.outputs.version }} | |
deploy: | |
needs: version | |
secrets: inherit | |
uses: ./.github/workflows/deploy.yml | |
with: | |
channel: ${{ inputs.increment == 'beta' && 'beta' || 'stable' }} | |
ref: release/v${{ needs.version.outputs.version }} | |
release: | |
needs: | |
- build-nix | |
- build-windows | |
- deploy | |
- version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: release/v${{ needs.version.outputs.version }} | |
- name: Git config | |
run: | | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git config user.name github-actions | |
git fetch --all | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Cargo release | |
run: nix develop -c cargo release release -x --no-confirm --no-push | |
- name: Merge release into main | |
run: | | |
git switch -c main --track origin/main | |
git merge --no-ff --no-edit release/v${{ needs.version.outputs.version }} | |
git push | |
- if: ${{ inputs.increment == 'beta' }} | |
name: Merge release into beta | |
run: | | |
git switch -c beta --track origin/beta | |
git merge --no-ff --no-edit release/v${{ needs.version.outputs.version }} | |
git push | |
- if: ${{ inputs.increment != 'beta' }} | |
name: Merge release into stable | |
run: | | |
# Delete beta and stable branches if they exist | |
git push origin --delete beta || echo "Branch doesn't exist" | |
git push origin --delete stable || echo "Branch doesn't exist" | |
# Create stable branch from release | |
git checkout release/v${{ needs.version.outputs.version }} | |
git checkout -b stable | |
git push origin stable | |
- name: Delete release branch | |
run: git push origin --delete release/v${{ needs.version.outputs.version }} | |
- run: mkdir artifacts | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "build-*" | |
path: artifacts | |
- name: Add version to build file names | |
run: | | |
cd artifacts | |
echo Current directory contents: | |
ls -la | |
for dir in *; do | |
cd $dir | |
for file in *; do | |
ext="${file##*.}" | |
name="${file%.*}" | |
mv "$file" "../${name}.${{ needs.version.outputs.version }}.$ext" | |
done | |
cd .. | |
rm -rf $dir | |
done | |
echo New directory contents: | |
ls -la | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: artifacts/* | |
generateReleaseNotes: true | |
prerelease: ${{ contains(needs.version.outputs.version, 'beta') }} | |
tag: v${{ needs.version.outputs.version }} |