release v0.1.2 #20
Workflow file for this run
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: | |
push: | |
tags: | |
- v* | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
steps: | |
- name: Create release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: false | |
prerelease: false | |
deploy-unix-releases: | |
runs-on: ${{ matrix.os }} | |
needs: create-release | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: linux | |
os: ubuntu-latest | |
- target: linux-musl | |
os: ubuntu-latest | |
- target: macos | |
os: macos-latest | |
# TODO: uncomment once nix build .#windows works | |
# - target: windows | |
# os: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v24 | |
with: | |
nix_path: nixpkgs=channel:nixos-23.11 | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: soywod | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Build release | |
run: nix build -L .#${{ matrix.target }} | |
- name: Copy binary | |
run: | | |
cp result/bin/comodoro* . | |
- name: Patch binary interpreter | |
if: ${{ matrix.target == 'linux' }} | |
run: | | |
nix-shell -p patchelf --command "sudo patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 comodoro" | |
- name: Prepare release archives | |
run: | | |
mkdir -p {man,completions} | |
nix run .#${{ matrix.target }} man ./man | |
nix run .#${{ matrix.target }} completion bash > ./completions/comodoro.bash | |
nix run .#${{ matrix.target }} completion elvish > ./completions/comodoro.elvish | |
nix run .#${{ matrix.target }} completion fish > ./completions/comodoro.fish | |
nix run .#${{ matrix.target }} completion powershell > ./completions/comodoro.powershell | |
nix run .#${{ matrix.target }} completion zsh > ./completions/comodoro.zsh | |
tar -czf comodoro.tgz comodoro* man completions | |
zip -r comodoro.zip comodoro* man completions | |
- name: Upload tarball release archive | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: comodoro.tgz | |
asset_name: comodoro-${{ matrix.target }}.tgz | |
asset_content_type: application/gzip | |
- name: Upload zip release archive | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: comodoro.zip | |
asset_name: comodoro-${{ matrix.target }}.zip | |
asset_content_type: application/zip | |
# TODO: remove me once nix build .#windows works | |
deploy-windows-release: | |
runs-on: windows-latest | |
needs: create-release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- name: Build release | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Copy binary | |
run: | | |
copy target/release/comodoro.exe . | |
- name: Prepare release archives | |
run: | | |
mkdir man | |
mkdir completions | |
./comodoro.exe man ./man | |
./comodoro.exe completion bash > ./completions/comodoro.bash | |
./comodoro.exe completion elvish > ./completions/comodoro.elvish | |
./comodoro.exe completion fish > ./completions/comodoro.fish | |
./comodoro.exe completion powershell > ./completions/comodoro.powershell | |
./comodoro.exe completion zsh > ./completions/comodoro.zsh | |
tar -czf comodoro.tgz comodoro.exe man completions | |
Compress-Archive -Path comodoro.exe,man,completions -DestinationPath comodoro.zip | |
- name: Upload tarball release archive | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: comodoro.tgz | |
asset_name: comodoro-windows.tgz | |
asset_content_type: application/gzip | |
- name: Upload zip release archive | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: comodoro.zip | |
asset_name: comodoro-windows.zip | |
asset_content_type: application/zip | |
publish-crates-io: | |
runs-on: ubuntu-latest | |
needs: create-release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v24 | |
with: | |
nix_path: nixpkgs=channel:nixos-23.11 | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
- name: Publish library to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN} |