Skip to content

release

release #1

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
version:
description: "version"
required: true
jobs:
version:
name: version
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.export.outputs.version }}
upload_url: ${{ steps.releaseExp.outputs.upload_url }}
steps:
- id: export
run: 'printf "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT'
- id: release
name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
tag: ${{ github.event.inputs.version }}
allowUpdates: true
removeArtifacts: true
makeLatest: true
- id: releaseExp
run: 'printf "upload_url=${{ steps.release.outputs.upload_url }}" >> $GITHUB_OUTPUT'
crates-io:
name: "crates.io"
runs-on: ubuntu-latest
needs:
- version
steps:
- uses: actions/checkout@v3
- name: install rust
run: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
- name: package assets (manpages)
run: |
cargo run --target=x86_64-unknown-linux-gnu -- man -o ./manpages -f manpages
cd ./manpages
tar -czf ../docs-manpages.tar.gz .
- name: package assets (markdown)
run: |
cargo run --target=x86_64-unknown-linux-gnu -- man -o ./markdown -f markdown
cd ./markdown
tar -czf ../docs-markdown.tar.gz .
- name: package assets (shell completion)
run: |
export GEN_CMD="cargo run --target=x86_64-unknown-linux-gnu -- autocomplete -o ./shell-completion"
$GEN_CMD -s bash
$GEN_CMD -s zsh
$GEN_CMD -s fish
$GEN_CMD -s elvish
$GEN_CMD -s powershell
cd ./shell-completion
tar -czf ../shell-completion.tar.gz .
- name: upload asset (manpages)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.version.outputs.upload_url }}
asset_path: ./docs-manpages.tar.gz
asset_name: docs-manpages.tar.gz
asset_content_type: application/tar+gzip
- name: upload asset (markdown)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.version.outputs.upload_url }}
asset_path: ./docs-markdown.tar.gz
asset_name: docs-markdown.tar.gz
asset_content_type: application/tar+gzip
- name: upload asset (shell completion)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.version.outputs.upload_url }}
asset_path: ./shell-completion.tar.gz
asset_name: shell-completion.tar.gz
asset_content_type: application/tar+gzip
- name: publish
run: |
cargo login ${{ secrets.CRATES_IO_LOGIN_TOKEN }}
sed 's/version = "0.0.0"/version = "'${{ needs.version.outputs.version }}'"/g' Cargo.toml > Cargo.toml.tmp
mv Cargo.toml.tmp Cargo.toml
cargo publish --target x86_64-unknown-linux-gnu --allow-dirty
deb:
name: "deb"
runs-on: ubuntu-latest
needs:
- version
- crates-io
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get install -y curl
- name: install rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
cargo install cargo-deb
- name: publish
run: |
sed 's/version = "0.0.0"/version = "'${{ needs.version.outputs.version }}'"/g' Cargo.toml > Cargo.toml.tmp
mv Cargo.toml.tmp Cargo.toml
cargo deb --target=x86_64-unknown-linux-gnu
export DEB_F=$(printf "${{ needs.version.outputs.version }}" | sed 's/-/~/g')
mv ./target/x86_64-unknown-linux-gnu/debian/agree_${DEB_F}_amd64.deb ./target/x86_64-unknown-linux-gnu/debian/agree_${{ needs.version.outputs.version }}_amd64.deb || true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.version.outputs.upload_url }}
asset_path: ./target/x86_64-unknown-linux-gnu/debian/agree_${{ needs.version.outputs.version }}_amd64.deb
asset_name: agree-amd64.deb
asset_content_type: application/octet-stream