Skip to content

release

release #72

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.FULL_GITHUB_TOKEN }}"
GITHUB_USER: "${{ github.actor }}"
jobs:
project-matrixes:
runs-on: ubuntu-latest
environment: Build
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@v4
- name: Get versio
uses: chaaz/versio-actions/install@v1.3
- 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
environment: Build
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get versio
uses: chaaz/versio-actions/install@v1.3
- name: Fetch history
run: git fetch --unshallow
- name: Check projects
run: versio -l local check
- name: Output plan
run: versio -l local plan
cargo-checks:
needs: project-matrixes
runs-on: ubuntu-latest
environment: Build
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@v4
- name: Get cargo nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Get cargo stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- 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
environment: Build
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get versio
uses: chaaz/versio-actions/install@v1.3
- name: Get cargo stable
uses: dtolnay/rust-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 -l local release
- name: Push release
run: git push
- name: Push release tags
run: git push --tags --force
cratesio-publish:
needs:
- project-matrixes
- versio-release
runs-on: ubuntu-latest
environment: Build
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@v4
with:
ref: main
- name: Get cargo nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Get cargo stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- 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
environment: Build
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@v4
with:
ref: main
- name: Get versio
uses: chaaz/versio-actions/install@v1.3
- 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: softprops/action-gh-release@v1
with:
token: "${{ secrets.FULL_GITHUB_TOKEN }}"
tag_name: "${{ steps.find-version.outputs.version }}"
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\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\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"
draft: true
prerelease: false
target_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 }}"
environment: Build
steps:
- name: Checkout release
uses: actions/checkout@v4
with:
ref: main
- name: Get cargo nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Get cargo stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- 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 binary
run: cargo build --release
working-directory: "${{ matrix.root }}"
env:
RUSTFLAGS: "${{ matrix.rustflags }}"
- name: Upload binary
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