0.13.1 #37
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]+' | |
- '[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
prepare-env: | |
name: Prepare environment | |
runs-on: ubuntu-latest | |
outputs: | |
release_version: ${{ steps.prepare-env.outputs.RELEASE_VERSION }} | |
steps: | |
- name: Get the release version from the tag | |
id: prepare-env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
build-release: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
needs: ['prepare-env'] | |
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 | |
key: ${{ runner.os }}-cargo-${{ matrix.target }} | |
# 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-crates: | |
name: Publish crate | |
needs: ['build-release'] | |
runs-on: ubuntu-latest | |
steps: | |
# checkout code | |
- uses: actions/checkout@v4 | |
# install just | |
- uses: extractions/setup-just@v1 | |
# install rust | |
- run: rustup show | |
# install dependencies | |
- run: just setup | |
# publish crate | |
- shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish | |
release-aur: | |
name: Update AUR(i3stat) | |
needs: ['release-crates', 'prepare-env'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: extractions/setup-just@v1 | |
- name: Setup SSH | |
run: | | |
eval "$(ssh-agent -s)" | |
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV | |
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV | |
ssh-add - <<< "${{ secrets.AUR_SSH_KEY }}" | |
mkdir -p $HOME/.ssh/ | |
echo "${{ vars.SSH_KNOWN_HOSTS }}" >> $HOME/.ssh/known_hosts | |
chmod 0600 $HOME/.ssh/* | |
- run: | | |
git clone ssh://[email protected]/i3stat.git aur && cd "$_" && git checkout master | |
sudo chown -R 1000:1000 "$PWD" | |
docker run \ | |
--rm \ | |
-v "$PWD:/pkg" \ | |
--env "GIT_AUTHOR_NAME=acheronfail" \ | |
--env "GIT_COMMITTER_NAME=acheronfail" \ | |
--env "[email protected]" \ | |
--env "[email protected]" \ | |
acheronfail/makepkg just update ${{ needs.prepare-env.outputs.release_version }} | |
sudo chown -R $USER:$USER "$PWD" | |
git push | |
release-aur-bin: | |
name: Update AUR(i3stat-bin) | |
needs: ['release-github', 'prepare-env'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: extractions/setup-just@v1 | |
- name: Setup SSH | |
run: | | |
eval "$(ssh-agent -s)" | |
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV | |
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV | |
ssh-add - <<< "${{ secrets.AUR_SSH_KEY }}" | |
mkdir -p $HOME/.ssh/ | |
echo "${{ vars.SSH_KNOWN_HOSTS }}" >> $HOME/.ssh/known_hosts | |
chmod 0600 $HOME/.ssh/* | |
- run: | | |
git clone ssh://[email protected]/i3stat-bin.git aur && cd "$_" && git checkout master | |
sudo chown -R 1000:1000 "$PWD" | |
docker run \ | |
--rm \ | |
-v "$PWD:/pkg" \ | |
--env "GIT_AUTHOR_NAME=acheronfail" \ | |
--env "GIT_COMMITTER_NAME=acheronfail" \ | |
--env "[email protected]" \ | |
--env "[email protected]" \ | |
acheronfail/makepkg just update ${{ needs.prepare-env.outputs.release_version }} | |
sudo chown -R $USER:$USER "$PWD" | |
git push | |
release-github: | |
name: GitHub Release | |
needs: ['build-release', 'prepare-env'] | |
runs-on: ubuntu-latest | |
steps: | |
# downloads artifacts (this downloads the folder called `artifacts` defined in the `build-release` step) | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: . | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/i3stat-x86_64-unknown-linux-gnu.zip | |
tag_name: ${{ needs.prepare-env.outputs.release_version }} | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |