Skip to content

tagged-release-linux-only #16

tagged-release-linux-only

tagged-release-linux-only #16

# .github/workflow/release-by-label.yml
# automatically perform release when a version tag is pushed via git
name: "tagged-release-linux-only"
on:
# For the time being, disable "push tag" so that only 1 action fires
# We don't want both actions to fire, the other action now covers std. Linux as well.
# push:
# tags:
# - "v*"
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
tagname:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag }}
steps:
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- id: vars
shell: bash
run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- if: env.TAG_NAME == 'nightly'
run: echo 'TAG_NAME=nightly-${{ steps.vars.outputs.sha_short }}' >> $GITHUB_ENV
- id: tag
run: echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
linux:
runs-on: ubuntu-latest
container: ubuntu:24.04
needs: tagname
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Install dependencies
run: |
apt-get -y update
apt-get -y install cmake pkg-config libfontconfig-dev libgtk-3-dev libssl-dev libolm-dev libc6 curl wget
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
profile: minimal
- name: Build
run: cargo build --profile release --bin matrix-commander-rs
- name: Gzip
run: |
mkdir matrix-commander-rs
cp ./target/release/matrix-commander-rs matrix-commander-rs/
cp README.md matrix-commander-rs/
cp LICENSE matrix-commander-rs/
cp help.help.txt help.manual.txt help.usage.txt matrix-commander-rs/
tar -zcvf ./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz matrix-commander-rs
# tar -zcvf ./matrix-commander-rs_linux.tar.gz matrix-commander-rs
sha256sum ./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz > ./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
echo "sha256 checksum: "
# cat ./matrix-commander-rs_${TAG_NAME}_linux.tar.gz.sha256sum
cat ./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
ls
ls -l
echo ${TAG_NAME} > tag.txt
cat tag.txt
- uses: actions/upload-artifact@v4
with:
name: plain-linux
path: |
./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
retention-days: 1
# https://github.com/softprops/action-gh-release
- name: Release
# run: |
# ls
# TAG_NAME=$(cat tag.txt)
# cat tag.txt
# echo $TAG_NAME
uses: "softprops/action-gh-release@v2"
if: startsWith(github.ref, 'refs/tags/')
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
generate_release_notes: true
files: |
./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
README.md
LICENSE
help.help.txt help.manual.txt help.usage.txt