Build and Release #18
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: | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- x86_64-pc-windows-gnu | |
- aarch64-pc-windows-gnu | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Extract Package Version" | |
id: cargo-version | |
run: | | |
version=v$(grep -oP 'version\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' dygma-layer-switcher/Cargo.toml | head -n 1) | |
echo "PACKAGE_VERSION=$version" | |
echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV | |
- name: "Set up Rust" | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
targets: ${{ matrix.target }} | |
- name: "Install Dependencies" | |
run: sudo apt-get install -y mingw-w64 libudev-dev zip wine64 | |
- name: "Build" | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: "Zip" | |
run: | | |
cp target/${{ matrix.target }}/release/dygma-layer-switcher.exe . | |
mv dygma-layer-switcher.exe "Dygma Layer Switcher.exe" | |
zip dls-${{ env.PACKAGE_VERSION }}-${{ matrix.target }}.zip "Dygma Layer Switcher.exe" | |
env: | |
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }} | |
- name: "Upload Artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dls-${{ env.PACKAGE_VERSION }}-${{ matrix.target }}.zip | |
name: dls-${{ env.PACKAGE_VERSION }}-${{ matrix.target }}.zip | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Download Artifacts" | |
uses: actions/download-artifact@v4 | |
with: | |
name: '**/dls-*.zip' | |
path: . | |
- name: "Create Git Tag" | |
run: | | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
git tag -a ${{ env.PACKAGE_VERSION }} -m "${{ env.PACKAGE_VERSION }}" | |
git push origin ${{ env.PACKAGE_VERSION }} | |
- name: "Create GitHub Release" | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.PACKAGE_VERSION }} | |
release_name: ${{ env.PACKAGE_VERSION }} | |
files: | | |
dls-${{ env.PACKAGE_VERSION }}-*.zip |