Skip to content

chore: release 0.8.0 #40

chore: release 0.8.0

chore: release 0.8.0 #40

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
jobs:
create_release:
name: Create draft release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Verify tag matches Cargo.toml version
run: |
CARGO_VERSION=$(grep -m1 version Cargo.toml | cut -d '"' -f2)
TAG_VERSION=${GITHUB_REF#refs/tags/v}
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: Cargo.toml ($CARGO_VERSION) vs Git tag ($TAG_VERSION)"
exit 1
fi
- name: Extract release notes
run: python3 ci/release-notes.py > notes.md
- name: Create draft release
run: gh release create ${{ github.ref_name }} --notes-file notes.md --draft
crates_io:
name: Publish to crates.io
needs: create_release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to crates.io
run: cargo publish --token ${{secrets.CARGO_REGISTRY_TOKEN}}
build:
name: Build binaries and publish release
needs: create_release
runs-on: ${{ matrix.os }}
env:
BUILD_FLAGS: build --release --locked --target ${{ matrix.target }}
ARCHIVE_NAME: fixit-${{ github.ref_name }}-${{ matrix.target }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
cross: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
cross: true
- os: macos-latest
target: x86_64-apple-darwin
cross: false
- os: macos-latest
target: aarch64-apple-darwin
cross: false
steps:
- name: Install cargo-deb
if: matrix.os == 'ubuntu-latest'
run: cargo install cargo-deb
- name: Add Rust target
if: ${{ ! matrix.cross }}
run: rustup target add ${{ matrix.target }}
- name: Checkout
uses: actions/checkout@v4
- name: Build (cargo)
if: ${{ ! matrix.cross }}
run: cargo $BUILD_FLAGS
- name: Build (cross)
if: ${{ matrix.cross }}
run: |
gh release download --repo 'cross-rs/cross' --pattern 'cross-x86_64-unknown-linux-musl.tar.gz'
tar -xvzf cross-x86_64-unknown-linux-musl.tar.gz
chmod +x ./cross
./cross $BUILD_FLAGS
- name: Upload binary archive
run: |
cp ./target/${{ matrix.target }}/release/fixit .
tar -czvf $ARCHIVE_NAME.tar.gz fixit
cat $ARCHIVE_NAME.tar.gz | shasum -a 256 | cut -d " " -f 1 | tr -d "\n" > $ARCHIVE_NAME.sha256
gh release upload ${{ github.ref_name }} $ARCHIVE_NAME.{tar.gz,sha256}
- name: Create and upload deb package
if: matrix.os == 'ubuntu-latest'
run: |
cargo deb --target=${{ matrix.target }} --no-build --no-strip
gh release upload ${{ github.ref_name }} ./target/${{ matrix.target }}/debian/*.deb
publish_release:
name: Publish release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish release
run: gh release edit ${{ github.ref_name }} --draft=false
publish_dep_repo:
name: Publish deb repository
runs-on: ubuntu-latest
needs: publish_release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish
run: |
mkdir -p _site/ppa
cd _site/ppa
gh release download ${{ github.ref_name }} --pattern '*.deb'
dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz
cd ..
touch .nojekyll
git init
git config user.name 'github-actions[bot]'
git config user.email '[email protected]'
git add -A
git commit -m 'deploy'
remote="https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY"
git push --force $remote 'master:gh-pages'
update-aur:
name: Update AUR repositories
runs-on: ubuntu-latest
container:
image: archlinux:latest
needs: publish_release
strategy:
matrix:
include:
- bin: ""
- bin: "-bin"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update AUR
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm rust openssh git
useradd -m -G wheel runner
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
chown -R runner:runner .
su runner -c '
VERSION=${GITHUB_REF#refs/tags/v}
mkdir -p ~/.ssh
echo "${{ secrets.AUR_SSH_KEY }}" > ~/.ssh/aur
chmod 600 ~/.ssh/aur
echo "Host aur.archlinux.org" >> ~/.ssh/config
echo " IdentityFile ~/.ssh/aur" >> ~/.ssh/config
echo " User aur" >> ~/.ssh/config
ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts
git clone ssh://[email protected]/fixit${{ matrix.bin }}.git aur
cargo xtask packaging $VERSION aur${{ matrix.bin }}
cp PKGBUILD .SRCINFO aur/
cd aur
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add PKGBUILD .SRCINFO
git commit -m "chore: release $VERSION"
git push origin master
'
update-homebrew:
name: Update Homebrew formula
runs-on: ubuntu-latest
needs: publish_release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Homebrew formula
run: |
VERSION=${GITHUB_REF#refs/tags/v}
git clone https://github.com/eugene-babichenko/homebrew-fixit.git
cargo xtask packaging $VERSION homebrew > ./homebrew-fixit/Formula/fixit.rb
cd homebrew-fixit
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://eugene-babichenko:${{ secrets.HOMEBREW_FORMULA_TOKEN }}@github.com/eugene-babichenko/homebrew-fixit.git
git add Formula/fixit.rb
git commit -m "chore: release $VERSION"
git push origin master