update CONTRIBUTING.md #25
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: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build-release: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
name: build-release | |
runs-on: ${{ matrix.os }} | |
steps: | |
# checkout code | |
- uses: actions/checkout@v4 | |
# install just | |
- uses: extractions/setup-just@v1 | |
# cache | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
~/.cargo/.crates.toml | |
~/.cargo/.crates2.json | |
target/ | |
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
# install rust | |
- run: rustup show && rustup target add ${{ matrix.target }} | |
# install dependencies | |
- run: just setup | |
# build (generates binaries) | |
- run: just build --locked --release --target=${{ matrix.target }} | |
- run: cargo test --locked manpage | |
# create archive | |
- name: Archive | |
shell: bash | |
run: | | |
staging="i3stat-${{ matrix.target }}" | |
mkdir "$staging" | |
cp -a doc "$staging" | |
files=( | |
"target/${{ matrix.target }}/release/i3stat" | |
"target/${{ matrix.target }}/release/i3stat-ipc" | |
"target/${{ matrix.target }}/release/i3stat-acpi" | |
"target/${{ matrix.target }}/release/i3stat-sensors" | |
"target/${{ matrix.target }}/release/i3stat-signals" | |
"README.md" | |
"sample_config.toml" | |
"sample_included_config.toml" | |
"LICENSE" | |
) | |
for file in ${files[@]}; do | |
cp $file "$staging" | |
done | |
zip -r "$staging.zip" "$staging" | |
# upload zip as an artifact (as a folder called `artifact`) | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: i3stat-${{ matrix.target }}.zip | |
release: | |
name: Release | |
needs: ['build-release'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the release version from the tag | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
# downloads artifacts (this downloads the folder called `artifacts` defined above) | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: . | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/i3stat-x86_64-unknown-linux-gnu.zip | |
tag_name: ${{ env.RELEASE_VERSION }} | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |