Skip to content

release

release #63

Workflow file for this run

---
# DO NOT EDIT
# Created from template "release.yml".
name: release
"on":
- workflow_dispatch
env:
RUSTFLAGS: "-D warnings"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_USER: "${{ github.actor }}"
jobs:
project-matrixes:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
outputs:
cargo-matrix: "${{ steps.find-cargo-matrix.outputs.matrix }}"
all-matrix: "${{ steps.find-all-matrix.outputs.matrix }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get versio
uses: chaaz/versio-actions/[email protected]
- name: Find cargo matrix
id: find-cargo-matrix
run: "echo \"::set-output name=matrix::{\\\"include\\\":$(versio -l none info -l cargo -R -N)}\""
- name: Find all matrix
id: find-all-matrix
run: "echo \"::set-output name=matrix::{\\\"include\\\":$(versio -l none info -a -R -N)}\""
versio-checks:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get versio
uses: chaaz/versio-actions/[email protected]
- name: Fetch history
run: git fetch --unshallow
- name: Check projects
run: versio check
- name: Output plan
run: versio plan
cargo-checks:
needs: project-matrixes
runs-on: ubuntu-latest
strategy:
matrix: "${{ fromJson(needs.project-matrixes.outputs.cargo-matrix) }}"
if: "!contains(github.event.head_commit.message, 'skip ci')"
defaults:
run:
working-directory: "${{ matrix.root }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libgpg-error-dev libgpgme-dev
- name: Get cargo stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
- name: Get cargo nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Find paths
id: cargo-find-paths
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock"
- name: Cache cargo and target
uses: actions/cache@v1
with:
path: "~/.cargo/registry\n~/.cargo/git\n${{ matrix.root }}/target\n"
key: "${{ runner.os }}-cargo-${{ hashFiles(steps.cargo-find-paths.outputs.cargo-lock-glob) }}"
- name: Check structure
run: cargo clippy
- name: Check format
run: cargo +nightly fmt -- --check
- name: Check tests
run: cargo test
versio-release:
needs:
- cargo-checks
- versio-checks
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get versio
uses: chaaz/versio-actions/[email protected]
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libgpg-error-dev libgpgme-dev
- name: Get cargo stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@v1
with:
path: "~/.cargo/registry\n~/.cargo/git\n"
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
- name: Fetch history
run: git fetch --unshallow
- name: Generate release
run: versio release
cratesio-publish:
needs:
- project-matrixes
- versio-release
runs-on: ubuntu-latest
strategy:
matrix: "${{fromJson(needs.project-matrixes.outputs.cargo-matrix)}}"
if: "!contains(github.event.head_commit.message, 'skip ci')"
defaults:
run:
working-directory: "${{ matrix.root }}"
steps:
- name: Checkout release
uses: actions/checkout@v3
with:
ref: main
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libgpg-error-dev libgpgme-dev
- name: Get cargo stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
- name: Get cargo nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Find paths
id: cargo-find-paths
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock"
- name: Cache cargo and target
uses: actions/cache@v1
with:
path: "~/.cargo/registry\n~/.cargo/git\n${{ matrix.root }}/target\n"
key: "${{ runner.os }}-cargo-${{ hashFiles(steps.cargo-find-paths.outputs.cargo-lock-glob) }}"
- name: Login to crates.io
run: "cargo login ${CRATES_IO_TOKEN}"
env:
CRATES_IO_TOKEN: "${{ secrets.CRATES_IO_TOKEN }}"
- name: Publish to crates.io
run: cargo publish
github-publish:
needs: versio-release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
outputs:
upload_url: "${{ steps.publish-to-github.outputs.upload_url }}"
steps:
- name: Checkout release
uses: actions/checkout@v3
with:
ref: main
- name: Get versio
uses: chaaz/versio-actions/[email protected]
- name: Find version
id: find-version
run: "echo ::set-output name=version::$(versio -l none info -i 0 -F | jq -r '.[0].full_version')"
- name: Publish to GitHub
id: publish-to-github
uses: actions/create-release@v1
with:
tag_name: "${{ steps.find-version.outputs.version }}"
release_name: "(TODO) RELEASE FOR ${{ steps.find-version.outputs.version }}"
body: "(TODO) SUMMARY\n- (TODO) FEATURE1\n\nNew to Versio? The [repository](https://github.com/chaaz/versio) is the best place to learn about Versio and what it can do. If you want to report a bug or request a feature, you can do so at our [Issues](https://github.com/chaaz/versio/issues) link, but we ask you first read the [Troubleshooting](https://github.com/chaaz/versio/blob/main/docs/troubleshooting.md) page learn about problems and their solutions.\n\nDEPENDENCIES:\n\nOn MacOS and Linux, you must have GPG tools installed. These tools are installed by default on most distributions of Linux and MacOS. If you can run `git`, then you probably have the necessary tools already installed.\n\nOn Windows, you need to install the GpgME package, which is available [here](https://gnupg.org/ftp/gcrypt/binary/gnupg-w32-2.3.1_20210420.exe) (Signature and checksum available from its [parent directory](https://gnupg.org/ftp/gcrypt/binary/)).\n\nIf you have any questions, you should view the [Installation page](https://github.com/chaaz/versio/blob/main/docs/installing.md) for information about installing and testing dependencies.\n\nINSTALLATION: \n\nTo install, follow the instructions for your platform; some files might be zipped for improved download speed. For example, on MacOS you can do something like this (assuming `~/bin` exists and is in your PATH):\n\n```sh\ncurl -L https://github.com/chaaz/versio/releases/download/${{ steps.find-version.outputs.version }}/versio__x86_64-apple-darwin -o ~/bin/versio\nchmod +x ~/bin/versio\n```\n\n**MacOS:** download `versio__x86_64-apple-darwin`, copy to `versio` in your PATH.\n**GNU Linux 64:** download `versio__x86_64-unknown-linux-gnu`, copy to `versio` in your PATH.\n**Windows:** download `versio__x86_64-pc-win32.exe`, copy to `versio.exe` in your %PATH.\n"
draft: true
prerelease: false
commitish: main
publish-versio:
needs: github-publish
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
root: "."
rustflags: "-D warnings -C link-args=-s"
bin_name: versio
- os: macos-latest
target: x86_64-apple-darwin
root: "."
rustflags: "-D warnings"
bin_name: versio
- os: windows-latest
target: x86_64-pc-windows-msvc
root: "."
rustflags: "-D warnings"
bin_name: versio.exe
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: "${{ matrix.os }}"
steps:
- name: Checkout release
uses: actions/checkout@v3
with:
ref: main
- name: Install Ubuntu dependencies
if: "matrix.os == 'ubuntu-latest'"
run: sudo apt-get update && sudo apt-get install -y libgpg-error-dev libgpgme-dev
- name: Install MacOS dependencies
if: "matrix.os == 'macos-latest'"
run: brew update; brew install gpgme
- name: Install Windows dependencies
if: "matrix.os == 'windows-latest'"
run: "choco install -y gnupg\necho \"C:\\Program Files (x86)\\GnuPG\\bin\" >> $env:GITHUB_PATH\n"
- name: Get cargo stable
if: "matrix.os != 'windows-latest'"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
- name: Get cargo nightly
if: "matrix.os != 'windows-latest'"
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Get Windows cargo stable
if: "matrix.os == 'windows-latest'"
uses: actions-rs/toolchain@v1
with:
toolchain: stable-i686-pc-windows-msvc
target: i686-pc-windows-gnu
components: clippy
default: true
- name: Get Windows cargo nightly
if: "matrix.os == 'windows-latest'"
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-i686-pc-windows-msvc
target: i686-pc-windows-gnu
components: rustfmt
- name: Update Windows target configuration
if: "matrix.os == 'windows-latest'"
run: rustup set default-host i686-pc-windows-gnu
- name: Find paths
id: cargo-find-paths
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock"
- name: Cache cargo and target
uses: actions/cache@v1
with:
path: "~/.cargo/registry\n~/.cargo/git\n${{ matrix.root }}/target\n"
key: "${{ runner.os }}-cargo-${{ hashFiles(steps.cargo-find-paths.outputs.cargo-lock-glob) }}"
- name: Build Ubuntu binary
if: "matrix.os == 'ubuntu-latest'"
run: cargo build --release
working-directory: "${{ matrix.root }}"
env:
RUSTFLAGS: "${{ matrix.rustflags }}"
LIBGPG_ERROR_INCLUDE: /usr/include/x86_64-linux-gnu
LIBGPG_ERROR_LIB_DIR: /usr/lib/x86_64-linux-gnu
LIBGPG_ERROR_LIBS: static=gpg-error
GPGME_INCLUDE: /usr/include
GPGME_LIB_DIR: /usr/lib/x86_64-linux-gnu
GPGME_LIBS: "static=gpgme:static=assuan"
- name: Build MacOS binary
if: "matrix.os == 'macos-latest'"
run: cargo build --release
working-directory: "${{ matrix.root }}"
env:
RUSTFLAGS: "${{ matrix.rustflags }}"
LIBGPG_ERROR_INCLUDE: /usr/local/opt/libgpg-error/include
LIBGPG_ERROR_LIB_DIR: /usr/local/opt/libgpg-error/lib
LIBGPG_ERROR_LIBS: static=gpg-error
GPGME_INCLUDE: "/usr/local/opt/libassuan/include:/usr/local/opt/gpgme/include"
GPGME_LIB_DIR: "/usr/local/opt/libassuan/lib:/usr/local/opt/gpgme/lib"
GPGME_LIBS: "static=gpgme:static=assuan"
- name: Set up MinGW
if: "matrix.os == 'windows-latest'"
uses: egor-tensin/setup-mingw@v2
with:
platform: x86
- name: Build Windows binary
if: "matrix.os == 'windows-latest'"
run: cargo build --release --target i686-pc-windows-gnu
working-directory: "${{ matrix.root }}"
env:
RUSTFLAGS: "${{ matrix.rustflags }}"
- name: Upload binary
if: "matrix.os != 'windows-latest'"
uses: actions/upload-release-asset@v1
with:
upload_url: "${{ needs.github-publish.outputs.upload_url }}"
asset_path: "target/release/${{ matrix.bin_name }}"
asset_name: "versio__${{ matrix.target }}"
asset_content_type: application/octet-stream
- name: Upload Windows binary
if: "matrix.os == 'windows-latest'"
uses: actions/upload-release-asset@v1
with:
upload_url: "${{ needs.github-publish.outputs.upload_url }}"
asset_path: "target/i686-pc-windows-gnu/release/${{ matrix.bin_name }}"
asset_name: "versio__${{ matrix.target }}"
asset_content_type: application/octet-stream